@operato/data-grist 7.1.13 → 7.1.25
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 +19 -0
- package/dist/src/data-grid/data-grid-body.js +6 -1
- package/dist/src/data-grid/data-grid-body.js.map +1 -1
- package/dist/src/editors/ox-grist-editor-varname.d.ts +6 -0
- package/dist/src/editors/ox-grist-editor-varname.js +36 -0
- package/dist/src/editors/ox-grist-editor-varname.js.map +1 -0
- package/dist/src/editors/registry.js +3 -1
- package/dist/src/editors/registry.js.map +1 -1
- package/dist/src/gutters/gutter-sequence.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/data-grid/data-grid-body.ts +5 -1
- package/src/editors/ox-grist-editor-varname.ts +36 -0
- package/src/editors/registry.ts +3 -1
- package/yarn-error.log +0 -16971
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@operato/data-grist",
|
3
|
-
"version": "7.1.
|
3
|
+
"version": "7.1.25",
|
4
4
|
"description": "User interface for grid (desktop) and list (mobile)",
|
5
5
|
"author": "heartyoh",
|
6
6
|
"main": "dist/index.js",
|
@@ -63,11 +63,11 @@
|
|
63
63
|
"dependencies": {
|
64
64
|
"@material/web": "^2.0.0",
|
65
65
|
"@operato/headroom": "^7.1.1",
|
66
|
-
"@operato/input": "^7.1.
|
67
|
-
"@operato/p13n": "^7.1.
|
68
|
-
"@operato/popup": "^7.1.
|
66
|
+
"@operato/input": "^7.1.25",
|
67
|
+
"@operato/p13n": "^7.1.25",
|
68
|
+
"@operato/popup": "^7.1.25",
|
69
69
|
"@operato/pull-to-refresh": "^7.1.1",
|
70
|
-
"@operato/styles": "^7.1.
|
70
|
+
"@operato/styles": "^7.1.25",
|
71
71
|
"@operato/time-calculator": "^7.1.1",
|
72
72
|
"@operato/utils": "^7.1.1",
|
73
73
|
"i18next": "^23.11.5",
|
@@ -108,5 +108,5 @@
|
|
108
108
|
"prettier --write"
|
109
109
|
]
|
110
110
|
},
|
111
|
-
"gitHead": "
|
111
|
+
"gitHead": "daa7b0f5953931135eec4fceee6c28e3ed150f7a"
|
112
112
|
}
|
@@ -650,7 +650,11 @@ export class DataGridBody extends LitElement {
|
|
650
650
|
value = parseToNumberOrNull(value)
|
651
651
|
break
|
652
652
|
default:
|
653
|
-
|
653
|
+
try {
|
654
|
+
value = JSON.parse(value)
|
655
|
+
} catch (err) {
|
656
|
+
value = value
|
657
|
+
}
|
654
658
|
}
|
655
659
|
|
656
660
|
if (targetColumn && !targetColumn.gutterName && editable) {
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { OxGristEditor } from './ox-grist-editor.js'
|
2
|
+
import { customElement } from 'lit/decorators.js'
|
3
|
+
import { html } from 'lit'
|
4
|
+
|
5
|
+
@customElement('ox-grist-editor-varname')
|
6
|
+
export class OxGristEditorVarname extends OxGristEditor {
|
7
|
+
get inlineEditable() {
|
8
|
+
return true
|
9
|
+
}
|
10
|
+
|
11
|
+
get editorTemplate() {
|
12
|
+
return html`
|
13
|
+
<input
|
14
|
+
type="text"
|
15
|
+
.value=${this.value}
|
16
|
+
@input=${this.handleInput}
|
17
|
+
pattern="^[A-Za-z_][A-Za-z0-9_]*$"
|
18
|
+
title="Variable names must start with a letter or underscore and contain only letters, numbers, or underscores."
|
19
|
+
/>
|
20
|
+
`
|
21
|
+
}
|
22
|
+
|
23
|
+
handleInput(event: KeyboardEvent) {
|
24
|
+
const input = event.target as HTMLInputElement
|
25
|
+
const regex = /^[A-Za-z_][A-Za-z0-9_]*$/
|
26
|
+
|
27
|
+
// Only allow valid characters as the user types
|
28
|
+
if (!regex.test(input.value)) {
|
29
|
+
// Keep only valid characters and start with a letter or underscore
|
30
|
+
input.value = input.value.replace(/[^A-Za-z0-9_]/g, '').replace(/^[^A-Za-z_]+/, '')
|
31
|
+
}
|
32
|
+
|
33
|
+
// Update the component's internal value state
|
34
|
+
this.value = input.value
|
35
|
+
}
|
36
|
+
}
|
package/src/editors/registry.ts
CHANGED
@@ -19,6 +19,7 @@ import { OxGristEditorTextarea } from './ox-grist-editor-textarea'
|
|
19
19
|
import { OxGristEditorTime } from './ox-grist-editor-time'
|
20
20
|
import { OxGristEditorTree } from './ox-grist-editor-tree'
|
21
21
|
import { OxGristEditorWeek } from './ox-grist-editor-week'
|
22
|
+
import { OxGristEditorVarname } from './ox-grist-editor-varname'
|
22
23
|
|
23
24
|
var EDITORS: { [name: string]: { new (): OxGristEditor } } = {
|
24
25
|
string: OxGristEditorText,
|
@@ -44,7 +45,8 @@ var EDITORS: { [name: string]: { new (): OxGristEditor } } = {
|
|
44
45
|
image: OxGristEditorImage,
|
45
46
|
file: OxGristEditorFile,
|
46
47
|
'string[]': OxGristEditorMultipleSelect,
|
47
|
-
tree: OxGristEditorTree
|
48
|
+
tree: OxGristEditorTree,
|
49
|
+
varname: OxGristEditorVarname
|
48
50
|
}
|
49
51
|
|
50
52
|
export function registerEditor(type: string, editor: { new (): OxGristEditor }) {
|