@operato/data-grist 7.1.13 → 7.1.21

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 CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [7.1.21](https://github.com/hatiolab/operato/compare/v7.1.20...v7.1.21) (2024-11-13)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * add ox-grist-editor-varname ([a560542](https://github.com/hatiolab/operato/commit/a5605427b5308034d0bc5120f58b7a48156bf424))
12
+ * add ox-grist-editor-varname ([f185cce](https://github.com/hatiolab/operato/commit/f185ccef111ad1d1c989069ac44efdc5a66e754c))
13
+
14
+
15
+
6
16
  ### [7.1.13](https://github.com/hatiolab/operato/compare/v7.1.12...v7.1.13) (2024-09-23)
7
17
 
8
18
  **Note:** Version bump only for package @operato/data-grist
@@ -0,0 +1,6 @@
1
+ import { OxGristEditor } from './ox-grist-editor.js';
2
+ export declare class OxGristEditorVarname extends OxGristEditor {
3
+ get inlineEditable(): boolean;
4
+ get editorTemplate(): import("lit-html").TemplateResult<1>;
5
+ handleInput(event: KeyboardEvent): void;
6
+ }
@@ -0,0 +1,36 @@
1
+ import { __decorate } from "tslib";
2
+ import { OxGristEditor } from './ox-grist-editor.js';
3
+ import { customElement } from 'lit/decorators.js';
4
+ import { html } from 'lit';
5
+ let OxGristEditorVarname = class OxGristEditorVarname extends OxGristEditor {
6
+ get inlineEditable() {
7
+ return true;
8
+ }
9
+ get editorTemplate() {
10
+ return html `
11
+ <input
12
+ type="text"
13
+ .value=${this.value}
14
+ @input=${this.handleInput}
15
+ pattern="^[A-Za-z_][A-Za-z0-9_]*$"
16
+ title="Variable names must start with a letter or underscore and contain only letters, numbers, or underscores."
17
+ />
18
+ `;
19
+ }
20
+ handleInput(event) {
21
+ const input = event.target;
22
+ const regex = /^[A-Za-z_][A-Za-z0-9_]*$/;
23
+ // Only allow valid characters as the user types
24
+ if (!regex.test(input.value)) {
25
+ // Keep only valid characters and start with a letter or underscore
26
+ input.value = input.value.replace(/[^A-Za-z0-9_]/g, '').replace(/^[^A-Za-z_]+/, '');
27
+ }
28
+ // Update the component's internal value state
29
+ this.value = input.value;
30
+ }
31
+ };
32
+ OxGristEditorVarname = __decorate([
33
+ customElement('ox-grist-editor-varname')
34
+ ], OxGristEditorVarname);
35
+ export { OxGristEditorVarname };
36
+ //# sourceMappingURL=ox-grist-editor-varname.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-editor-varname.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-varname.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAGnB,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,aAAa;IACrD,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA;;;iBAGE,IAAI,CAAC,KAAK;iBACV,IAAI,CAAC,WAAW;;;;KAI5B,CAAA;IACH,CAAC;IAED,WAAW,CAAC,KAAoB;QAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAA;QAC9C,MAAM,KAAK,GAAG,0BAA0B,CAAA;QAExC,gDAAgD;QAChD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,mEAAmE;YACnE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;QACrF,CAAC;QAED,8CAA8C;QAC9C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;IAC1B,CAAC;CACF,CAAA;AA9BY,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CA8BhC","sourcesContent":["import { OxGristEditor } from './ox-grist-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n@customElement('ox-grist-editor-varname')\nexport class OxGristEditorVarname extends OxGristEditor {\n get inlineEditable() {\n return true\n }\n\n get editorTemplate() {\n return html`\n <input\n type=\"text\"\n .value=${this.value}\n @input=${this.handleInput}\n pattern=\"^[A-Za-z_][A-Za-z0-9_]*$\"\n title=\"Variable names must start with a letter or underscore and contain only letters, numbers, or underscores.\"\n />\n `\n }\n\n handleInput(event: KeyboardEvent) {\n const input = event.target as HTMLInputElement\n const regex = /^[A-Za-z_][A-Za-z0-9_]*$/\n\n // Only allow valid characters as the user types\n if (!regex.test(input.value)) {\n // Keep only valid characters and start with a letter or underscore\n input.value = input.value.replace(/[^A-Za-z0-9_]/g, '').replace(/^[^A-Za-z_]+/, '')\n }\n\n // Update the component's internal value state\n this.value = input.value\n }\n}\n"]}
@@ -16,6 +16,7 @@ import { OxGristEditorTextarea } from './ox-grist-editor-textarea';
16
16
  import { OxGristEditorTime } from './ox-grist-editor-time';
17
17
  import { OxGristEditorTree } from './ox-grist-editor-tree';
18
18
  import { OxGristEditorWeek } from './ox-grist-editor-week';
19
+ import { OxGristEditorVarname } from './ox-grist-editor-varname';
19
20
  var EDITORS = {
20
21
  string: OxGristEditorText,
21
22
  text: OxGristEditorText,
@@ -40,7 +41,8 @@ var EDITORS = {
40
41
  image: OxGristEditorImage,
41
42
  file: OxGristEditorFile,
42
43
  'string[]': OxGristEditorMultipleSelect,
43
- tree: OxGristEditorTree
44
+ tree: OxGristEditorTree,
45
+ varname: OxGristEditorVarname
44
46
  };
45
47
  export function registerEditor(type, editor) {
46
48
  EDITORS[type] = editor;
@@ -1 +1 @@
1
- {"version":3,"file":"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AAG,GAAG,QAAQ,CAAA;QACtB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QAErB,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { DataGridField } from '../data-grid/data-grid-field'\nimport { ColumnConfig, FieldEditor, GristRecord } from '../types'\nimport { OxGristEditor } from './ox-grist-editor'\nimport { OxGristEditorCheckbox } from './ox-grist-editor-checkbox'\nimport { OxGristEditorColor } from './ox-grist-editor-color'\nimport { OxGristEditorDate } from './ox-grist-editor-date'\nimport { OxGristEditorDateTime } from './ox-grist-editor-datetime'\nimport { OxGristEditorEmail } from './ox-grist-editor-email'\nimport { OxGristEditorFile } from './ox-grist-editor-file'\nimport { OxGristEditorImage } from './ox-grist-editor-image'\nimport { OxGristEditorMonth } from './ox-grist-editor-month'\nimport { OxGristEditorMultipleSelect } from './ox-grist-editor-multiple-select'\nimport { OxGristEditorNumber } from './ox-grist-editor-number'\nimport { OxGristEditorPassword } from './ox-grist-editor-password'\nimport { OxGristEditorSelect } from './ox-grist-editor-select'\nimport { OxGristEditorTel } from './ox-grist-editor-tel'\nimport { OxGristEditorText } from './ox-grist-editor-text'\nimport { OxGristEditorTextarea } from './ox-grist-editor-textarea'\nimport { OxGristEditorTime } from './ox-grist-editor-time'\nimport { OxGristEditorTree } from './ox-grist-editor-tree'\nimport { OxGristEditorWeek } from './ox-grist-editor-week'\n\nvar EDITORS: { [name: string]: { new (): OxGristEditor } } = {\n string: OxGristEditorText,\n text: OxGristEditorText,\n textarea: OxGristEditorTextarea,\n email: OxGristEditorEmail,\n tel: OxGristEditorTel,\n password: OxGristEditorPassword,\n integer: OxGristEditorNumber,\n float: OxGristEditorNumber,\n number: OxGristEditorNumber,\n select: OxGristEditorSelect,\n boolean: OxGristEditorCheckbox,\n checkbox: OxGristEditorCheckbox,\n month: OxGristEditorMonth,\n week: OxGristEditorWeek,\n date: OxGristEditorDate,\n time: OxGristEditorTime,\n datetime: OxGristEditorDateTime,\n color: OxGristEditorColor,\n progress: OxGristEditorNumber,\n link: OxGristEditorText,\n image: OxGristEditorImage,\n file: OxGristEditorFile,\n 'string[]': OxGristEditorMultipleSelect,\n tree: OxGristEditorTree\n}\n\nexport function registerEditor(type: string, editor: { new (): OxGristEditor }) {\n EDITORS[type] = editor\n}\n\nexport function unregisterEditor(type: string) {\n delete EDITORS[type]\n}\n\nexport function getEditors(): { [name: string]: { new (): OxGristEditor } } {\n return { ...EDITORS }\n}\n\nexport function getEditor(type: string): FieldEditor {\n if (typeof type == 'function') {\n return type\n }\n\n return function (value: any, column: ColumnConfig, record: GristRecord, rowIndex: number, field: DataGridField) {\n var clazz = EDITORS[type || 'text'] || OxGristEditorText\n\n var element = new clazz()\n\n element.value = value\n element.record = record\n element.column = column\n element.row = rowIndex\n element.field = field\n\n return element\n }\n}\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/editors/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;A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AAC,IAAY;IAC3C,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,EAAE,GAAG,OAAO,EAAE,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,OAAO,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,UAAU,KAAU,EAAE,MAAoB,EAAE,MAAmB,EAAE,QAAgB,EAAE,KAAoB;QAC5G,IAAI,KAAK,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,iBAAiB,CAAA;QAExD,IAAI,OAAO,GAAG,IAAI,KAAK,EAAE,CAAA;QAEzB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACrB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAA;QACtB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QAErB,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { DataGridField } from '../data-grid/data-grid-field'\nimport { ColumnConfig, FieldEditor, GristRecord } from '../types'\nimport { OxGristEditor } from './ox-grist-editor'\nimport { OxGristEditorCheckbox } from './ox-grist-editor-checkbox'\nimport { OxGristEditorColor } from './ox-grist-editor-color'\nimport { OxGristEditorDate } from './ox-grist-editor-date'\nimport { OxGristEditorDateTime } from './ox-grist-editor-datetime'\nimport { OxGristEditorEmail } from './ox-grist-editor-email'\nimport { OxGristEditorFile } from './ox-grist-editor-file'\nimport { OxGristEditorImage } from './ox-grist-editor-image'\nimport { OxGristEditorMonth } from './ox-grist-editor-month'\nimport { OxGristEditorMultipleSelect } from './ox-grist-editor-multiple-select'\nimport { OxGristEditorNumber } from './ox-grist-editor-number'\nimport { OxGristEditorPassword } from './ox-grist-editor-password'\nimport { OxGristEditorSelect } from './ox-grist-editor-select'\nimport { OxGristEditorTel } from './ox-grist-editor-tel'\nimport { OxGristEditorText } from './ox-grist-editor-text'\nimport { OxGristEditorTextarea } from './ox-grist-editor-textarea'\nimport { OxGristEditorTime } from './ox-grist-editor-time'\nimport { OxGristEditorTree } from './ox-grist-editor-tree'\nimport { OxGristEditorWeek } from './ox-grist-editor-week'\nimport { OxGristEditorVarname } from './ox-grist-editor-varname'\n\nvar EDITORS: { [name: string]: { new (): OxGristEditor } } = {\n string: OxGristEditorText,\n text: OxGristEditorText,\n textarea: OxGristEditorTextarea,\n email: OxGristEditorEmail,\n tel: OxGristEditorTel,\n password: OxGristEditorPassword,\n integer: OxGristEditorNumber,\n float: OxGristEditorNumber,\n number: OxGristEditorNumber,\n select: OxGristEditorSelect,\n boolean: OxGristEditorCheckbox,\n checkbox: OxGristEditorCheckbox,\n month: OxGristEditorMonth,\n week: OxGristEditorWeek,\n date: OxGristEditorDate,\n time: OxGristEditorTime,\n datetime: OxGristEditorDateTime,\n color: OxGristEditorColor,\n progress: OxGristEditorNumber,\n link: OxGristEditorText,\n image: OxGristEditorImage,\n file: OxGristEditorFile,\n 'string[]': OxGristEditorMultipleSelect,\n tree: OxGristEditorTree,\n varname: OxGristEditorVarname\n}\n\nexport function registerEditor(type: string, editor: { new (): OxGristEditor }) {\n EDITORS[type] = editor\n}\n\nexport function unregisterEditor(type: string) {\n delete EDITORS[type]\n}\n\nexport function getEditors(): { [name: string]: { new (): OxGristEditor } } {\n return { ...EDITORS }\n}\n\nexport function getEditor(type: string): FieldEditor {\n if (typeof type == 'function') {\n return type\n }\n\n return function (value: any, column: ColumnConfig, record: GristRecord, rowIndex: number, field: DataGridField) {\n var clazz = EDITORS[type || 'text'] || OxGristEditorText\n\n var element = new clazz()\n\n element.value = value\n element.record = record\n element.column = column\n element.row = rowIndex\n element.field = field\n\n return element\n }\n}\n"]}