@operato/data-grist 2.0.0-alpha.11 → 2.0.0-alpha.13
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 +22 -0
- package/dist/src/data-grid/data-grid-accum-field.js +3 -2
- package/dist/src/data-grid/data-grid-accum-field.js.map +1 -1
- package/dist/src/data-grid/data-grid-body.js +3 -0
- package/dist/src/data-grid/data-grid-body.js.map +1 -1
- package/dist/src/editors/ox-grist-editor-number.js +2 -2
- package/dist/src/editors/ox-grist-editor-number.js.map +1 -1
- package/dist/src/editors/ox-grist-editor.js +5 -1
- package/dist/src/editors/ox-grist-editor.js.map +1 -1
- package/dist/src/handlers/contextmenu-tree-mutation.js +0 -18
- package/dist/src/handlers/contextmenu-tree-mutation.js.map +1 -1
- package/dist/stories/accumulator.stories.js +8 -4
- package/dist/stories/accumulator.stories.js.map +1 -1
- package/dist/stories/dynamic-editable.stories.js +10 -0
- package/dist/stories/dynamic-editable.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/data-grid/data-grid-accum-field.ts +3 -2
- package/src/data-grid/data-grid-body.ts +3 -0
- package/src/editors/ox-grist-editor-number.ts +3 -2
- package/src/editors/ox-grist-editor.ts +5 -1
- package/src/handlers/contextmenu-tree-mutation.ts +0 -18
- package/stories/accumulator.stories.ts +8 -4
- package/stories/dynamic-editable.stories.ts +10 -0
- package/themes/grist-theme.css +1 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
import { OxGristEditor } from './ox-grist-editor.js'
|
2
2
|
import { customElement } from 'lit/decorators.js'
|
3
3
|
import { html } from 'lit'
|
4
|
+
import { parseToNumberOrNull } from '@operato/utils'
|
4
5
|
|
5
6
|
@customElement('ox-grist-editor-number')
|
6
7
|
export class OxGristEditorNumber extends OxGristEditor {
|
@@ -9,9 +10,9 @@ export class OxGristEditorNumber extends OxGristEditor {
|
|
9
10
|
|
10
11
|
switch (this.column.type) {
|
11
12
|
case 'float':
|
12
|
-
return Number.parseFloat(value)
|
13
|
+
return Number.parseFloat(value) || 0
|
13
14
|
case 'integer':
|
14
|
-
return Number.parseInt(value)
|
15
|
+
return Number.parseInt(value) || 0
|
15
16
|
default:
|
16
17
|
return Number(value)
|
17
18
|
}
|
@@ -5,6 +5,7 @@ import { ZERO_COLUMN, ZERO_RECORD } from '../configure/zero-config'
|
|
5
5
|
import { DataGridField } from '../data-grid/data-grid-field'
|
6
6
|
import { ColumnConfig, GristRecord } from '../types'
|
7
7
|
import { getDefaultValue } from '../value-generator'
|
8
|
+
import { parseToNumberOrNull } from '@operato/utils'
|
8
9
|
|
9
10
|
const STYLE = css`
|
10
11
|
:host {
|
@@ -123,7 +124,10 @@ export class OxGristEditor extends LitElement {
|
|
123
124
|
|
124
125
|
// 입력을 위한 키를 누르면서 편집모드가 될때는 누른 키가 처음에 입력되도록, enter 같은 것을 눌러서 편집모드가 되면 현재 값으로 편집모드 전환
|
125
126
|
const editorValue = this.field?.valueWithEdit ? this.field.valueWithEdit : this.formatForEditor(currentValue)
|
126
|
-
|
127
|
+
const fieldType = this.field?.type || 'string'
|
128
|
+
this.value = this._dirtyValue = ['number', 'float', 'integer', 'progress'].includes(fieldType)
|
129
|
+
? parseToNumberOrNull(editorValue)
|
130
|
+
: editorValue
|
127
131
|
|
128
132
|
requestAnimationFrame(() => {
|
129
133
|
this.focus()
|
@@ -54,24 +54,6 @@ export const ContextMenuTreeMutation = function (
|
|
54
54
|
<mwc-icon slot="icon">playlist_add</mwc-icon>
|
55
55
|
</ox-popup-menuitem>
|
56
56
|
|
57
|
-
<ox-popup-menuitem
|
58
|
-
label="move up"
|
59
|
-
@click=${() => {
|
60
|
-
dispatchEvent(field, 'move-up')
|
61
|
-
}}
|
62
|
-
>
|
63
|
-
<mwc-icon slot="icon">arrow_upward</mwc-icon>
|
64
|
-
</ox-popup-menuitem>
|
65
|
-
|
66
|
-
<ox-popup-menuitem
|
67
|
-
label="move down"
|
68
|
-
@click=${() => {
|
69
|
-
dispatchEvent(field, 'move-down')
|
70
|
-
}}
|
71
|
-
>
|
72
|
-
<mwc-icon slot="icon">arrow_downward</mwc-icon>
|
73
|
-
</ox-popup-menuitem>
|
74
|
-
|
75
57
|
<div separator></div>
|
76
58
|
|
77
59
|
<ox-popup-menuitem
|
@@ -106,6 +106,10 @@ const config = {
|
|
106
106
|
align: 'right'
|
107
107
|
},
|
108
108
|
accumulator: 'avg',
|
109
|
+
// accumulator: {
|
110
|
+
// type: 'avg',
|
111
|
+
// tag: true
|
112
|
+
// },
|
109
113
|
sortable: true,
|
110
114
|
width: 130
|
111
115
|
},
|
@@ -116,7 +120,10 @@ const config = {
|
|
116
120
|
header: 'accval2',
|
117
121
|
record: {
|
118
122
|
editable: true,
|
119
|
-
align: 'right'
|
123
|
+
align: 'right',
|
124
|
+
renderer: (value: any, column: any, record: any) => {
|
125
|
+
return value && Intl.NumberFormat('en-US').format(value)
|
126
|
+
}
|
120
127
|
},
|
121
128
|
accumulator: {
|
122
129
|
type: 'sum',
|
@@ -163,9 +170,6 @@ const config = {
|
|
163
170
|
{
|
164
171
|
name: 'name',
|
165
172
|
desc: true
|
166
|
-
},
|
167
|
-
{
|
168
|
-
name: 'email'
|
169
173
|
}
|
170
174
|
],
|
171
175
|
pagination: {
|
@@ -24,6 +24,7 @@ const fetchHandler: FetchHandler = async ({ sorters = [], filters, page, limit }
|
|
24
24
|
name: idx % 2 ? `shnam-${start + idx + 1}` : `heartyoh-${start + idx + 1}`,
|
25
25
|
description: idx % 2 ? `hatiolabmanager${start + idx + 1}1234567890` : `hatiosea manager-${start + idx + 1}`,
|
26
26
|
number: idx,
|
27
|
+
float: 1.3,
|
27
28
|
date: '2023-09-20',
|
28
29
|
routing: {
|
29
30
|
id: '006dc64d-4fb9-4afc-a9ea-962bd1b9e110',
|
@@ -117,6 +118,15 @@ function buildConfig({ headerFilter }: { headerFilter: boolean }) {
|
|
117
118
|
},
|
118
119
|
width: 80
|
119
120
|
},
|
121
|
+
{
|
122
|
+
type: 'float',
|
123
|
+
name: 'float',
|
124
|
+
header: 'float',
|
125
|
+
record: {
|
126
|
+
editable: true
|
127
|
+
},
|
128
|
+
width: 80
|
129
|
+
},
|
120
130
|
{
|
121
131
|
type: 'date',
|
122
132
|
name: 'date',
|
package/themes/grist-theme.css
CHANGED
@@ -41,7 +41,7 @@ body {
|
|
41
41
|
|
42
42
|
--grid-record-background-color: var(--theme-white-color);
|
43
43
|
--grid-record-odd-background-color: #f9f7f5;
|
44
|
-
--grid-record-padding: 0
|
44
|
+
--grid-record-padding: 0 5px 0 5px;
|
45
45
|
--grid-record-color: var(--secondary-color);
|
46
46
|
--grid-record-color-hover: var(--primary-color);
|
47
47
|
--grid-record-wide-fontsize: var(--fontsize-small);
|