@operato/data-grist 2.0.0-alpha.9 → 2.0.0-alpha.90
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 +349 -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 +38 -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 +149 -111
- 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 +98 -70
- 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 +98 -70
- 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 +147 -78
- 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 +99 -70
- 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 +100 -71
- 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 +144 -112
- 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 +535 -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 +177 -124
- 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 +144 -112
- 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 +136 -103
- 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 +148 -116
- 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 +148 -116
- 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 +38 -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 +153 -119
- package/stories/barcode-input-filter.stories.ts +109 -80
- package/stories/default-filters.stories.ts +111 -82
- package/stories/dynamic-editable.stories.ts +155 -85
- package/stories/empty-sorters.stories.ts +112 -82
- package/stories/explicit-fetch.stories.ts +113 -83
- package/stories/fixed-column.stories.ts +159 -126
- package/stories/grid-setting.stories.ts +572 -0
- package/stories/grist-modes.stories.ts +191 -142
- package/stories/group-header.stories.ts +159 -126
- package/stories/textarea.stories.ts +141 -112
- package/stories/tree-column-with-checkbox.stories.ts +158 -125
- package/stories/tree-column.stories.ts +158 -125
- 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
|
@@ -328,31 +401,32 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
328
401
|
.pagination=${this.pagination || {}}
|
329
402
|
?empty=${empty}
|
330
403
|
>
|
404
|
+
<slot name="setting" slot="setting"> </slot>
|
331
405
|
</ox-grid>
|
332
406
|
`
|
333
407
|
: 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
|
-
|
408
|
+
? html`
|
409
|
+
<ox-card
|
410
|
+
id="grist"
|
411
|
+
.config=${this.compiledConfig}
|
412
|
+
.data=${this._data}
|
413
|
+
.sorters=${this.sorters || []}
|
414
|
+
.filters=${this.filters || []}
|
415
|
+
?empty=${empty}
|
416
|
+
>
|
417
|
+
</ox-card>
|
418
|
+
`
|
419
|
+
: html`
|
420
|
+
<ox-list
|
421
|
+
id="grist"
|
422
|
+
.config=${this.compiledConfig}
|
423
|
+
.data=${this._data}
|
424
|
+
.sorters=${this.sorters || []}
|
425
|
+
.filters=${this.filters || []}
|
426
|
+
?empty=${empty}
|
427
|
+
>
|
428
|
+
</ox-list>
|
429
|
+
`}
|
356
430
|
</div>
|
357
431
|
|
358
432
|
<div id="spinner" ?show=${this._showSpinner}></div>
|
@@ -372,10 +446,22 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
372
446
|
}
|
373
447
|
}
|
374
448
|
|
449
|
+
/**
|
450
|
+
* Gets the current state of the component. The state includes information about the
|
451
|
+
* dirty records and their changes.
|
452
|
+
*
|
453
|
+
* @getter
|
454
|
+
* @public
|
455
|
+
* @type {string}
|
456
|
+
*/
|
375
457
|
get state() {
|
376
458
|
return JSON.stringify(this.dirtyData)
|
377
459
|
}
|
378
460
|
|
461
|
+
/**
|
462
|
+
* Undoes the previous change in the component's data by restoring it to the previous state.
|
463
|
+
* This method is part of the TimeCapsule feature, allowing users to revert changes.
|
464
|
+
*/
|
379
465
|
undo() {
|
380
466
|
if (!this.timeCapsule?.backwardable) {
|
381
467
|
return
|
@@ -384,6 +470,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
384
470
|
this._data = JSON.parse(this.timeCapsule?.backward())
|
385
471
|
}
|
386
472
|
|
473
|
+
/**
|
474
|
+
* Redoes the previously undone change in the component's data by restoring it to the next state.
|
475
|
+
* This method is part of the TimeCapsule feature, allowing users to reapply changes.
|
476
|
+
*/
|
387
477
|
redo() {
|
388
478
|
if (!this.timeCapsule?.forwardable) {
|
389
479
|
return
|
@@ -392,6 +482,13 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
392
482
|
this._data = JSON.parse(this.timeCapsule?.forward())
|
393
483
|
}
|
394
484
|
|
485
|
+
/**
|
486
|
+
* Fetches data from a data source and updates the component's data. This method is used to retrieve
|
487
|
+
* new data or refresh the existing data in the component.
|
488
|
+
*
|
489
|
+
* @method
|
490
|
+
* @param {boolean} reset - If true, the method resets the scroll position to the top.
|
491
|
+
*/
|
395
492
|
async fetch(reset = true) {
|
396
493
|
if (!this.compiledConfig) {
|
397
494
|
/* avoid to be here */
|
@@ -499,19 +596,58 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
499
596
|
}
|
500
597
|
}
|
501
598
|
|
599
|
+
/**
|
600
|
+
* Represents the compiled configuration of the component, which includes various settings and
|
601
|
+
* column configurations. You can access this property to get information about how the component
|
602
|
+
* is configured.
|
603
|
+
*
|
604
|
+
* @getter
|
605
|
+
* @public
|
606
|
+
* @type {GristConfig}
|
607
|
+
*/
|
502
608
|
get compiledConfig(): GristConfig {
|
503
609
|
return this._config
|
504
610
|
}
|
505
611
|
|
612
|
+
/**
|
613
|
+
* Returns the dirty data in the component, which includes the records that have been added,
|
614
|
+
* modified, or deleted but have not been committed to the main data yet.
|
615
|
+
*
|
616
|
+
* @getter
|
617
|
+
* @public
|
618
|
+
* @type {GristData} - An object representing the dirty data.
|
619
|
+
*/
|
506
620
|
get dirtyData(): GristData {
|
507
621
|
return (this.grist as any)?.data || {}
|
508
622
|
}
|
509
623
|
|
624
|
+
/**
|
625
|
+
* Returns an array of GristRecord objects representing the records in the dirty state. These are
|
626
|
+
* the records that have been added, modified, or deleted but have not been committed to the main
|
627
|
+
* data yet.
|
628
|
+
*
|
629
|
+
* @getter
|
630
|
+
* @public
|
631
|
+
* @type {GristRecord[]} - An array of GristRecord objects representing the dirty records.
|
632
|
+
*/
|
510
633
|
get dirtyRecords() {
|
511
634
|
var { records = [] } = this.dirtyData
|
512
635
|
return records.filter(record => record['__dirty__'])
|
513
636
|
}
|
514
637
|
|
638
|
+
/**
|
639
|
+
* Exports a list of patches representing the changes in the dirty state of records. Each patch
|
640
|
+
* contains information about whether a record was added, modified, or deleted, along with the
|
641
|
+
* record's unique identifier and the changed field values.
|
642
|
+
*
|
643
|
+
* @param {Object} options - Export options that control the format of the patch list.
|
644
|
+
* @param {string} options.flagName - The name of the flag field in the patch indicating the change type (default: 'patchFlag').
|
645
|
+
* @param {string} options.addedFlag - The flag value for added records (default: '+').
|
646
|
+
* @param {string} options.deletedFlag - The flag value for deleted records (default: '-').
|
647
|
+
* @param {string} options.modifiedFlag - The flag value for modified records (default: 'M').
|
648
|
+
* @param {string} options.idField - The name of the unique identifier field (default: 'id').
|
649
|
+
* @returns {Object[]} - An array of objects representing the patches.
|
650
|
+
*/
|
515
651
|
exportPatchList({ flagName = 'patchFlag', addedFlag = '+', deletedFlag = '-', modifiedFlag = 'M', idField = 'id' }) {
|
516
652
|
let dirtyRecords = this.dirtyRecords
|
517
653
|
if (!dirtyRecords || dirtyRecords.length == 0) {
|
@@ -536,6 +672,15 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
536
672
|
})
|
537
673
|
}
|
538
674
|
|
675
|
+
/**
|
676
|
+
* Exports the selected records or all records in the component, depending on the specified options.
|
677
|
+
* You can use this method to export data from the component in various formats or for different purposes.
|
678
|
+
*
|
679
|
+
* @param {Object} options - Export options that control the behavior of the export.
|
680
|
+
* @param {boolean} options.ifSelectedOnly - If true, exports only the selected records. If false, exports all records.
|
681
|
+
* @param {boolean} options.includeHiddenField - If true, includes hidden fields in the exported data.
|
682
|
+
* @returns {Object[]} - An array of objects representing the exported records.
|
683
|
+
*/
|
539
684
|
exportRecords({ ifSelectedOnly = true, includeHiddenField = true } = {}) {
|
540
685
|
let records = ifSelectedOnly ? this.selected : this.data.records
|
541
686
|
|
@@ -557,11 +702,27 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
557
702
|
})
|
558
703
|
}
|
559
704
|
|
705
|
+
/**
|
706
|
+
* Gets the currently selected records in the component. It returns an array of GristRecord objects
|
707
|
+
* that are currently selected. You can access this getter to retrieve the selected records.
|
708
|
+
*
|
709
|
+
* @getter
|
710
|
+
* @public
|
711
|
+
* @type {GristRecord[]}
|
712
|
+
*/
|
560
713
|
get selected() {
|
561
714
|
var { records = [] } = this.grist?.data
|
562
715
|
return records.filter(record => record['__selected__'])
|
563
716
|
}
|
564
717
|
|
718
|
+
/**
|
719
|
+
* Sets the currently selected records in the component. You can use this setter to programmatically
|
720
|
+
* select specific records by providing an array of GristRecord objects to be selected.
|
721
|
+
*
|
722
|
+
* @setter
|
723
|
+
* @public
|
724
|
+
* @type {GristRecord[]}
|
725
|
+
*/
|
565
726
|
set selected(selected: GristRecord[]) {
|
566
727
|
if (!this.grist) {
|
567
728
|
console.warn('grist not ready')
|
@@ -572,6 +733,15 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
572
733
|
this.refresh()
|
573
734
|
}
|
574
735
|
|
736
|
+
/**
|
737
|
+
* Selects records in the component based on the provided selector function. You can use this method
|
738
|
+
* to programmatically select specific records in the component.
|
739
|
+
*
|
740
|
+
* @method
|
741
|
+
* @param {GristSelectFunction} selector - A function that determines which records to select.
|
742
|
+
* @param {boolean} reset - If true, clears the previous selection before applying the new one.
|
743
|
+
* If false, adds to the existing selection.
|
744
|
+
*/
|
575
745
|
select(selector: GristSelectFunction, reset: boolean = false) {
|
576
746
|
var { records = [] } = this.grist?.data
|
577
747
|
|
@@ -583,20 +753,36 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
583
753
|
this.refresh()
|
584
754
|
}
|
585
755
|
|
756
|
+
/**
|
757
|
+
* Shows the loading spinner in the component's UI to indicate ongoing data loading or processing.
|
758
|
+
* You can call this method to display the spinner when necessary.
|
759
|
+
*/
|
586
760
|
showSpinner() {
|
587
761
|
this._showSpinner = true
|
588
762
|
}
|
589
763
|
|
764
|
+
/**
|
765
|
+
* Hides the loading spinner in the component's UI to indicate that data loading or processing has completed.
|
766
|
+
* You can call this method to hide the spinner when loading or processing is finished.
|
767
|
+
*/
|
590
768
|
hideSpinner() {
|
591
769
|
this._showSpinner = false
|
592
770
|
}
|
593
771
|
|
772
|
+
/**
|
773
|
+
* Focuses on the component, making it the active element in the document. This method is useful
|
774
|
+
* when you want to programmatically set focus to the component.
|
775
|
+
*/
|
594
776
|
focus() {
|
595
777
|
super.focus()
|
596
778
|
|
597
779
|
this.grist.focus()
|
598
780
|
}
|
599
781
|
|
782
|
+
/**
|
783
|
+
* Commits the changes made in the dirty state to the component's data. This method updates the
|
784
|
+
* component's data with the changes made in the dirty state and clears the dirty state.
|
785
|
+
*/
|
600
786
|
commit() {
|
601
787
|
var { page, total, limit, records } = this.grist.data
|
602
788
|
|
@@ -626,6 +812,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
626
812
|
}
|
627
813
|
}
|
628
814
|
|
815
|
+
/**
|
816
|
+
* Shows the headroom element in the component. The headroom element is typically used for
|
817
|
+
* displaying additional information or controls at the top of the component.
|
818
|
+
*/
|
629
819
|
showHeadroom() {
|
630
820
|
if (this.head) {
|
631
821
|
this.head.style.display = 'block'
|
@@ -633,6 +823,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
633
823
|
}
|
634
824
|
}
|
635
825
|
|
826
|
+
/**
|
827
|
+
* Hides the headroom element in the component. This method hides the additional information
|
828
|
+
* or controls displayed at the top of the component.
|
829
|
+
*/
|
636
830
|
hideHeadroom() {
|
637
831
|
if (this.head) {
|
638
832
|
this.head.style.display = 'none'
|
@@ -640,6 +834,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
640
834
|
}
|
641
835
|
}
|
642
836
|
|
837
|
+
/**
|
838
|
+
* Toggles the visibility of the headroom element in the component. If the headroom element is
|
839
|
+
* currently visible, this method hides it. If it's hidden, this method shows it.
|
840
|
+
*/
|
643
841
|
toggleHeadroom() {
|
644
842
|
if (this.head) {
|
645
843
|
const display = this.head.style.display
|
@@ -660,13 +858,14 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
660
858
|
}
|
661
859
|
|
662
860
|
/**
|
663
|
-
*
|
861
|
+
* Resets the component's data to its original state before any changes were made.
|
862
|
+
* This method discards all unsaved changes and restores the data to its initial state.
|
664
863
|
*
|
665
864
|
* @method
|
666
|
-
*
|
667
|
-
* TODO tree 형태의 데이타로 _data를 만들 때, children, collapsed 등을 감안한다.
|
865
|
+
* @public
|
668
866
|
*/
|
669
867
|
reset() {
|
868
|
+
// TODO tree 형태의 데이타로 _data를 만들 때, children, collapsed 등을 감안한다.
|
670
869
|
var {
|
671
870
|
limit = ZERO_PAGINATION.limit,
|
672
871
|
page = ZERO_PAGINATION.page,
|
@@ -741,6 +940,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
741
940
|
}
|
742
941
|
}
|
743
942
|
|
943
|
+
/**
|
944
|
+
* Checks for dirty records in the component's data and marks them as dirty.
|
945
|
+
* Dirty records are those that have unsaved changes.
|
946
|
+
*/
|
744
947
|
checkDirties() {
|
745
948
|
const records = this.dirtyRecords
|
746
949
|
const { columns = [] } = this.compiledConfig || {}
|
@@ -771,6 +974,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
771
974
|
this.snapshotTaker?.touch()
|
772
975
|
}
|
773
976
|
|
977
|
+
/**
|
978
|
+
* Clones the selected records in the component's data. It creates a copy of the selected records
|
979
|
+
* and marks them as new (added) records.
|
980
|
+
*/
|
774
981
|
cloneSelectedRecords() {
|
775
982
|
const records = this.selected || ([] as GristRecord[])
|
776
983
|
|
@@ -792,6 +999,37 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
792
999
|
this.checkDirties()
|
793
1000
|
}
|
794
1001
|
|
1002
|
+
/**
|
1003
|
+
* Adds child nodes to selected records in the component's tree data. It allows users to add child nodes
|
1004
|
+
* to the selected parent records.
|
1005
|
+
*/
|
1006
|
+
addChildNodes() {
|
1007
|
+
const records = this.selected || ([] as GristRecord[])
|
1008
|
+
|
1009
|
+
records.forEach(record => {
|
1010
|
+
this.grist.addChildNode(record)
|
1011
|
+
})
|
1012
|
+
}
|
1013
|
+
|
1014
|
+
/**
|
1015
|
+
* Adds sibling nodes to selected records in the component's tree data. It allows users to add sibling nodes
|
1016
|
+
* to the selected records.
|
1017
|
+
*/
|
1018
|
+
addSiblingNodes() {
|
1019
|
+
const records = this.selected || ([] as GristRecord[])
|
1020
|
+
|
1021
|
+
records.forEach(record => {
|
1022
|
+
this.grist.addSiblingNode(record)
|
1023
|
+
})
|
1024
|
+
}
|
1025
|
+
|
1026
|
+
/**
|
1027
|
+
* Deletes the selected records in the component's data. It removes the selected records from the data,
|
1028
|
+
* optionally marking them as deleted.
|
1029
|
+
*
|
1030
|
+
* @method
|
1031
|
+
* @param {boolean} dirty - If true, the method marks the records as deleted.
|
1032
|
+
*/
|
795
1033
|
deleteSelectedRecords(dirty = true) {
|
796
1034
|
const records = this.selected || ([] as GristRecord[])
|
797
1035
|
|
@@ -807,10 +1045,20 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
807
1045
|
this.checkDirties()
|
808
1046
|
}
|
809
1047
|
|
1048
|
+
/**
|
1049
|
+
* Retrieves the search text used for filtering records.
|
1050
|
+
*
|
1051
|
+
* @property {string}
|
1052
|
+
*/
|
810
1053
|
get searchText() {
|
811
1054
|
return (this.filters?.find(filter => filter.operator === 'search')?.value as string)?.match(/^\%(.*)\%$/)?.[1] || ''
|
812
1055
|
}
|
813
1056
|
|
1057
|
+
/**
|
1058
|
+
* Sets the search text for filtering records.
|
1059
|
+
*
|
1060
|
+
* @property {string}
|
1061
|
+
*/
|
814
1062
|
set searchText(searchText: string) {
|
815
1063
|
var filters = (this.filters || []).filter((filter: FilterValue) => filter.operator !== 'search')
|
816
1064
|
|
@@ -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
|