@operato/input 2.0.0-alpha.13 → 2.0.0-alpha.133
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 +373 -0
- package/demo/index-multiple-colors.html +14 -2
- package/demo/index-partition-keys.html +13 -2
- package/demo/index-select.html +20 -9
- package/demo/index-table.html +13 -2
- package/demo/index.html +13 -2
- package/dist/src/locale/locale-picker.d.ts +1 -1
- package/dist/src/ox-buttons-radio.d.ts +1 -1
- package/dist/src/ox-checkbox.d.ts +5 -4
- package/dist/src/ox-checkbox.js +12 -6
- package/dist/src/ox-checkbox.js.map +1 -1
- package/dist/src/ox-input-3axis.d.ts +1 -1
- package/dist/src/ox-input-3dish.d.ts +1 -1
- package/dist/src/ox-input-angle.d.ts +1 -1
- package/dist/src/ox-input-barcode.d.ts +1 -1
- package/dist/src/ox-input-barcode.js +3 -3
- package/dist/src/ox-input-barcode.js.map +1 -1
- package/dist/src/ox-input-code.d.ts +2 -3
- package/dist/src/ox-input-code.js +8 -15
- package/dist/src/ox-input-code.js.map +1 -1
- package/dist/src/ox-input-color-gradient.d.ts +1 -1
- package/dist/src/ox-input-color-stops.d.ts +1 -1
- package/dist/src/ox-input-color.d.ts +1 -1
- package/dist/src/ox-input-container.d.ts +2 -2
- package/dist/src/ox-input-container.js +2 -2
- package/dist/src/ox-input-container.js.map +1 -1
- package/dist/src/ox-input-crontab.d.ts +1 -2
- package/dist/src/ox-input-crontab.js +4 -7
- package/dist/src/ox-input-crontab.js.map +1 -1
- package/dist/src/ox-input-data.d.ts +2 -1
- package/dist/src/ox-input-data.js +60 -22
- package/dist/src/ox-input-data.js.map +1 -1
- package/dist/src/ox-input-duration.d.ts +1 -2
- package/dist/src/ox-input-duration.js +13 -9
- package/dist/src/ox-input-duration.js.map +1 -1
- package/dist/src/ox-input-file.d.ts +2 -2
- package/dist/src/ox-input-file.js +10 -9
- package/dist/src/ox-input-file.js.map +1 -1
- package/dist/src/ox-input-hashtags.d.ts +1 -1
- package/dist/src/ox-input-i18n-label.d.ts +33 -0
- package/dist/src/ox-input-i18n-label.js +130 -0
- package/dist/src/ox-input-i18n-label.js.map +1 -0
- package/dist/src/ox-input-image.d.ts +2 -2
- package/dist/src/ox-input-image.js +4 -4
- package/dist/src/ox-input-image.js.map +1 -1
- package/dist/src/ox-input-key-values.d.ts +2 -2
- package/dist/src/ox-input-key-values.js +9 -10
- package/dist/src/ox-input-key-values.js.map +1 -1
- package/dist/src/ox-input-mass-fraction.d.ts +2 -2
- package/dist/src/ox-input-mass-fraction.js +46 -29
- package/dist/src/ox-input-mass-fraction.js.map +1 -1
- package/dist/src/ox-input-multiple-colors.d.ts +2 -2
- package/dist/src/ox-input-multiple-colors.js +7 -7
- package/dist/src/ox-input-multiple-colors.js.map +1 -1
- package/dist/src/ox-input-options.d.ts +2 -2
- package/dist/src/ox-input-options.js +5 -7
- package/dist/src/ox-input-options.js.map +1 -1
- package/dist/src/ox-input-partition-keys.d.ts +2 -2
- package/dist/src/ox-input-partition-keys.js +10 -10
- package/dist/src/ox-input-partition-keys.js.map +1 -1
- package/dist/src/ox-input-privilege.d.ts +1 -2
- package/dist/src/ox-input-privilege.js +15 -31
- package/dist/src/ox-input-privilege.js.map +1 -1
- package/dist/src/ox-input-quantifier.d.ts +1 -1
- package/dist/src/ox-input-scene-component-id.d.ts +1 -1
- package/dist/src/ox-input-search.d.ts +2 -2
- package/dist/src/ox-input-search.js +5 -4
- package/dist/src/ox-input-search.js.map +1 -1
- package/dist/src/ox-input-select-buttons.d.ts +3 -1
- package/dist/src/ox-input-select-buttons.js +14 -10
- package/dist/src/ox-input-select-buttons.js.map +1 -1
- package/dist/src/ox-input-stack.d.ts +1 -1
- package/dist/src/ox-input-table.d.ts +1 -1
- package/dist/src/ox-input-table.js +12 -12
- package/dist/src/ox-input-table.js.map +1 -1
- package/dist/src/ox-input-textarea.d.ts +1 -1
- package/dist/src/ox-input-unit-number.d.ts +2 -2
- package/dist/src/ox-input-unit-number.js +5 -4
- package/dist/src/ox-input-unit-number.js.map +1 -1
- package/dist/src/ox-input-value-map.d.ts +2 -2
- package/dist/src/ox-input-value-map.js +17 -17
- package/dist/src/ox-input-value-map.js.map +1 -1
- package/dist/src/ox-input-value-ranges.d.ts +2 -2
- package/dist/src/ox-input-value-ranges.js +22 -17
- package/dist/src/ox-input-value-ranges.js.map +1 -1
- package/dist/src/ox-input-work-shift.d.ts +1 -1
- package/dist/src/ox-input-work-shift.js +4 -8
- package/dist/src/ox-input-work-shift.js.map +1 -1
- package/dist/src/ox-select.d.ts +2 -2
- package/dist/src/ox-select.js +16 -10
- package/dist/src/ox-select.js.map +1 -1
- package/dist/src/ox-zoomable-image.d.ts +17 -0
- package/dist/src/ox-zoomable-image.js +80 -0
- package/dist/src/ox-zoomable-image.js.map +1 -0
- package/dist/stories/ox-input-3axis.stories.js +14 -1
- package/dist/stories/ox-input-3axis.stories.js.map +1 -1
- package/dist/stories/ox-input-3dish.stories.js +14 -1
- package/dist/stories/ox-input-3dish.stories.js.map +1 -1
- package/dist/stories/ox-input-angle.stories.js +13 -1
- package/dist/stories/ox-input-angle.stories.js.map +1 -1
- package/dist/stories/ox-input-barcode.stories.js +13 -1
- package/dist/stories/ox-input-barcode.stories.js.map +1 -1
- package/dist/stories/ox-input-code.stories.d.ts +4 -0
- package/dist/stories/ox-input-code.stories.js +18 -3
- package/dist/stories/ox-input-code.stories.js.map +1 -1
- package/dist/stories/ox-input-crontab.stories.js +13 -1
- package/dist/stories/ox-input-crontab.stories.js.map +1 -1
- package/dist/stories/ox-input-data.stories.d.ts +0 -4
- package/dist/stories/ox-input-data.stories.js +14 -4
- package/dist/stories/ox-input-data.stories.js.map +1 -1
- package/dist/stories/ox-input-duration.stories.js +13 -1
- package/dist/stories/ox-input-duration.stories.js.map +1 -1
- package/dist/stories/ox-input-file.stories.js +13 -1
- package/dist/stories/ox-input-file.stories.js.map +1 -1
- package/dist/stories/ox-input-hashtags.stories.js +13 -1
- package/dist/stories/ox-input-hashtags.stories.js.map +1 -1
- package/dist/stories/ox-input-i18n-label.stories.d.ts +29 -0
- package/dist/stories/ox-input-i18n-label.stories.js +70 -0
- package/dist/stories/ox-input-i18n-label.stories.js.map +1 -0
- package/dist/stories/ox-input-key-values.stories.js +13 -1
- package/dist/stories/ox-input-key-values.stories.js.map +1 -1
- package/dist/stories/ox-input-mass-fraction.stories.js +13 -1
- package/dist/stories/ox-input-mass-fraction.stories.js.map +1 -1
- package/dist/stories/ox-input-multiple-colors.stories.js +21 -11
- package/dist/stories/ox-input-multiple-colors.stories.js.map +1 -1
- package/dist/stories/ox-input-options.stories.js +13 -1
- package/dist/stories/ox-input-options.stories.js.map +1 -1
- package/dist/stories/ox-input-partition-keys.stories.js +13 -1
- package/dist/stories/ox-input-partition-keys.stories.js.map +1 -1
- package/dist/stories/ox-input-privilege.stories.js +13 -1
- package/dist/stories/ox-input-privilege.stories.js.map +1 -1
- package/dist/stories/ox-input-quantifier.stories.js +13 -1
- package/dist/stories/ox-input-quantifier.stories.js.map +1 -1
- package/dist/stories/ox-input-range.stories.js +13 -1
- package/dist/stories/ox-input-range.stories.js.map +1 -1
- package/dist/stories/ox-input-search.stories.js +13 -1
- package/dist/stories/ox-input-search.stories.js.map +1 -1
- package/dist/stories/ox-input-select-buttons.stories.js +13 -1
- package/dist/stories/ox-input-select-buttons.stories.js.map +1 -1
- package/dist/stories/ox-input-unit.stories.js +14 -1
- package/dist/stories/ox-input-unit.stories.js.map +1 -1
- package/dist/stories/ox-input-value-map.stories.js +13 -1
- package/dist/stories/ox-input-value-map.stories.js.map +1 -1
- package/dist/stories/ox-input-value-ranges.stories.js +13 -1
- package/dist/stories/ox-input-value-ranges.stories.js.map +1 -1
- package/dist/stories/ox-input-work-shift.stories.js +13 -1
- package/dist/stories/ox-input-work-shift.stories.js.map +1 -1
- package/dist/stories/ox-select.stories.js +13 -1
- package/dist/stories/ox-select.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -21
- package/src/ox-checkbox.ts +9 -6
- package/src/ox-input-barcode.ts +3 -3
- package/src/ox-input-code.ts +6 -13
- package/src/ox-input-container.ts +2 -2
- package/src/ox-input-crontab.ts +4 -8
- package/src/ox-input-data.ts +68 -24
- package/src/ox-input-duration.ts +13 -10
- package/src/ox-input-file.ts +10 -9
- package/src/ox-input-i18n-label.ts +140 -0
- package/src/ox-input-image.ts +4 -4
- package/src/ox-input-key-values.ts +27 -22
- package/src/ox-input-mass-fraction.ts +46 -29
- package/src/ox-input-multiple-colors.ts +7 -7
- package/src/ox-input-options.ts +5 -7
- package/src/ox-input-partition-keys.ts +28 -22
- package/src/ox-input-privilege.ts +15 -32
- package/src/ox-input-search.ts +5 -4
- package/src/ox-input-select-buttons.ts +19 -13
- package/src/ox-input-table.ts +12 -12
- package/src/ox-input-unit-number.ts +5 -4
- package/src/ox-input-value-map.ts +19 -19
- package/src/ox-input-value-ranges.ts +24 -19
- package/src/ox-input-work-shift.ts +4 -8
- package/src/ox-select.ts +16 -10
- package/src/ox-zoomable-image.ts +75 -0
- package/stories/ox-input-3axis.stories.ts +14 -1
- package/stories/ox-input-3dish.stories.ts +14 -1
- package/stories/ox-input-angle.stories.ts +13 -1
- package/stories/ox-input-barcode.stories.ts +13 -1
- package/stories/ox-input-code.stories.ts +25 -3
- package/stories/ox-input-crontab.stories.ts +13 -1
- package/stories/ox-input-data.stories.ts +14 -4
- package/stories/ox-input-duration.stories.ts +13 -1
- package/stories/ox-input-file.stories.ts +13 -1
- package/stories/ox-input-hashtags.stories.ts +13 -1
- package/stories/ox-input-i18n-label.stories.ts +85 -0
- package/stories/ox-input-key-values.stories.ts +13 -1
- package/stories/ox-input-mass-fraction.stories.ts +13 -1
- package/stories/ox-input-multiple-colors.stories.ts +21 -11
- package/stories/ox-input-options.stories.ts +13 -1
- package/stories/ox-input-partition-keys.stories.ts +13 -1
- package/stories/ox-input-privilege.stories.ts +13 -1
- package/stories/ox-input-quantifier.stories.ts +13 -1
- package/stories/ox-input-range.stories.ts +13 -1
- package/stories/ox-input-search.stories.ts +13 -1
- package/stories/ox-input-select-buttons.stories.ts +13 -1
- package/stories/ox-input-unit.stories.ts +14 -1
- package/stories/ox-input-value-map.stories.ts +13 -1
- package/stories/ox-input-value-ranges.stories.ts +13 -1
- package/stories/ox-input-work-shift.stories.ts +13 -1
- package/stories/ox-select.stories.ts +13 -1
- package/themes/app-theme.css +1 -1
- package/themes/input-theme.css +20 -7
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/input",
|
|
3
3
|
"description": "Webcomponents for input following open-wc recommendations",
|
|
4
4
|
"author": "heartyoh@hatiolab.com",
|
|
5
|
-
"version": "2.0.0-alpha.
|
|
5
|
+
"version": "2.0.0-alpha.133",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"module": "dist/src/index.js",
|
|
8
8
|
"license": "MIT",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"./ox-input-search.js": "./dist/src/ox-input-search.js",
|
|
47
47
|
"./ox-input-value-map.js": "./dist/src/ox-input-value-map.js",
|
|
48
48
|
"./ox-input-value-ranges.js": "./dist/src/ox-input-value-ranges.js",
|
|
49
|
+
"./ox-input-i18n-label.js": "./dist/src/ox-input-i18n-label.js",
|
|
49
50
|
"./ox-input-partition-keys.js": "./dist/src/ox-input-partition-keys.js",
|
|
50
51
|
"./ox-input-table.js": "./dist/src/ox-input-table.js",
|
|
51
52
|
"./ox-input-scene-component-id.js": "./dist/src/ox-input-scene-component-id.js",
|
|
@@ -143,6 +144,9 @@
|
|
|
143
144
|
"./ox-input-value-ranges.js": [
|
|
144
145
|
"./dist/src/ox-input-value-ranges.d.ts"
|
|
145
146
|
],
|
|
147
|
+
"./ox-input-i18n-label.js": [
|
|
148
|
+
"./dist/src/ox-input-i18n-label.d.ts"
|
|
149
|
+
],
|
|
146
150
|
"./ox-input-partition-keys.js": [
|
|
147
151
|
"./dist/src/ox-input-partition-keys.d.ts"
|
|
148
152
|
],
|
|
@@ -189,39 +193,39 @@
|
|
|
189
193
|
"@codemirror/state": "^6.3.3",
|
|
190
194
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
191
195
|
"@codemirror/view": "^6.22.1",
|
|
192
|
-
"@lit/localize": "^0.
|
|
193
|
-
"@material/
|
|
194
|
-
"@operato/color-picker": "^2.0.0-alpha.
|
|
195
|
-
"@operato/i18n": "^2.0.0-alpha.
|
|
196
|
-
"@operato/popup": "^2.0.0-alpha.
|
|
197
|
-
"@operato/styles": "^2.0.0-alpha.
|
|
198
|
-
"@operato/utils": "^2.0.0-alpha.
|
|
196
|
+
"@lit/localize": "^0.12.1",
|
|
197
|
+
"@material/web": "^1.4.0",
|
|
198
|
+
"@operato/color-picker": "^2.0.0-alpha.111",
|
|
199
|
+
"@operato/i18n": "^2.0.0-alpha.111",
|
|
200
|
+
"@operato/popup": "^2.0.0-alpha.129",
|
|
201
|
+
"@operato/styles": "^2.0.0-alpha.129",
|
|
202
|
+
"@operato/utils": "^2.0.0-alpha.122",
|
|
199
203
|
"@polymer/paper-dropdown-menu": "^3.2.0",
|
|
200
204
|
"@polymer/paper-item": "^3.0.1",
|
|
201
205
|
"@thebespokepixel/es-tinycolor": "^3.1.0",
|
|
202
206
|
"@types/codemirror": "^5.60.5",
|
|
203
207
|
"@undecaf/zbar-wasm": "^0.10.1",
|
|
204
208
|
"codemirror": "^6.0.1",
|
|
205
|
-
"lit": "^
|
|
209
|
+
"lit": "^3.1.2",
|
|
206
210
|
"lodash-es": "^4.17.21"
|
|
207
211
|
},
|
|
208
212
|
"devDependencies": {
|
|
209
|
-
"@custom-elements-manifest/analyzer": "^0.
|
|
213
|
+
"@custom-elements-manifest/analyzer": "^0.9.2",
|
|
210
214
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
211
|
-
"@lit/localize-tools": "^0.
|
|
212
|
-
"@open-wc/eslint-config": "^
|
|
215
|
+
"@lit/localize-tools": "^0.7.2",
|
|
216
|
+
"@open-wc/eslint-config": "^12.0.3",
|
|
213
217
|
"@open-wc/testing": "^3.1.6",
|
|
214
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
215
|
-
"@typescript-eslint/parser": "^
|
|
218
|
+
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
219
|
+
"@typescript-eslint/parser": "^7.0.1",
|
|
216
220
|
"@web/dev-server": "^0.3.0",
|
|
217
|
-
"@web/dev-server-storybook": "^0.
|
|
218
|
-
"@web/test-runner": "^0.
|
|
221
|
+
"@web/dev-server-storybook": "^2.0.1",
|
|
222
|
+
"@web/test-runner": "^0.18.0",
|
|
219
223
|
"concurrently": "^8.0.1",
|
|
220
224
|
"eslint": "^8.39.0",
|
|
221
|
-
"eslint-config-prettier": "^
|
|
222
|
-
"husky": "^
|
|
223
|
-
"lint-staged": "^
|
|
224
|
-
"prettier": "^2.
|
|
225
|
+
"eslint-config-prettier": "^9.1.0",
|
|
226
|
+
"husky": "^9.0.11",
|
|
227
|
+
"lint-staged": "^15.2.2",
|
|
228
|
+
"prettier": "^3.2.5",
|
|
225
229
|
"tslib": "^2.3.1",
|
|
226
230
|
"typescript": "^5.0.4"
|
|
227
231
|
},
|
|
@@ -239,5 +243,5 @@
|
|
|
239
243
|
"prettier --write"
|
|
240
244
|
]
|
|
241
245
|
},
|
|
242
|
-
"gitHead": "
|
|
246
|
+
"gitHead": "41207ed084ed81b0222d1eca7d4ad05418ffb926"
|
|
243
247
|
}
|
package/src/ox-checkbox.ts
CHANGED
|
@@ -15,12 +15,10 @@ import { OxFormField } from './ox-form-field'
|
|
|
15
15
|
export class OxCheckbox extends OxFormField {
|
|
16
16
|
static styles = [
|
|
17
17
|
css`
|
|
18
|
-
:host {
|
|
19
|
-
display: flex;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
18
|
div {
|
|
23
19
|
display: flex;
|
|
20
|
+
gap: var(--input-intra-gap, 7px);
|
|
21
|
+
|
|
24
22
|
align-items: center;
|
|
25
23
|
cursor: pointer;
|
|
26
24
|
}
|
|
@@ -65,7 +63,6 @@ export class OxCheckbox extends OxFormField {
|
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
[label] {
|
|
68
|
-
margin: var(--ox-checkbox-label-margin, 0 0 0 7px);
|
|
69
66
|
color: var(--ox-checkbox-label-color, #3a5877);
|
|
70
67
|
}
|
|
71
68
|
|
|
@@ -78,16 +75,22 @@ export class OxCheckbox extends OxFormField {
|
|
|
78
75
|
@property({ type: Boolean, attribute: 'checked', reflect: true }) checked: boolean | undefined = false
|
|
79
76
|
@property({ type: Boolean, attribute: 'indeterminatable' }) indeterminatable: boolean = false
|
|
80
77
|
@property({ type: Boolean, attribute: 'indeterminate', reflect: true }) indeterminate: boolean = false
|
|
78
|
+
@property({ type: Boolean, attribute: 'left-label' }) left: boolean = false
|
|
81
79
|
|
|
82
80
|
@state() _hasInner: boolean = !!this.innerHTML.trim().length
|
|
83
81
|
|
|
84
82
|
render() {
|
|
85
83
|
return html`
|
|
86
84
|
<div @click=${this.onClick} ?disabled=${this.disabled}>
|
|
85
|
+
${this._hasInner && this.left
|
|
86
|
+
? html` <span label>
|
|
87
|
+
<slot></slot>
|
|
88
|
+
</span>`
|
|
89
|
+
: ''}
|
|
87
90
|
<a href="#" @click=${(e: Event) => e.preventDefault()} checkbox>
|
|
88
91
|
${this.indeterminate ? this.indeterminateIcon : this.checked ? this.checkedIcon : this.uncheckedIcon}
|
|
89
92
|
</a>
|
|
90
|
-
${this._hasInner
|
|
93
|
+
${this._hasInner && !this.left
|
|
91
94
|
? html` <span label>
|
|
92
95
|
<slot></slot>
|
|
93
96
|
</span>`
|
package/src/ox-input-barcode.ts
CHANGED
|
@@ -60,13 +60,13 @@ export class OxInputBarcode extends OxFormField {
|
|
|
60
60
|
|
|
61
61
|
input {
|
|
62
62
|
flex: 1;
|
|
63
|
-
width: 10px; /* intentionally width set */
|
|
64
63
|
border: 0;
|
|
65
64
|
border-bottom: var(--border-dark-color);
|
|
66
65
|
padding: var(--input-padding);
|
|
67
66
|
padding-right: 35px;
|
|
68
67
|
font: var(--input-font);
|
|
69
68
|
color: var(--primary-text-color);
|
|
69
|
+
background-color: inherit;
|
|
70
70
|
}
|
|
71
71
|
input:focus {
|
|
72
72
|
outline: none;
|
|
@@ -225,12 +225,12 @@ export class OxInputBarcode extends OxFormField {
|
|
|
225
225
|
this.popup = OxPopup.open({
|
|
226
226
|
template: html`
|
|
227
227
|
<video></video>
|
|
228
|
-
<
|
|
228
|
+
<md-icon
|
|
229
229
|
style="position: fixed; right: 0; top: 0; color: red; tabindex: 0"
|
|
230
230
|
@click=${() => {
|
|
231
231
|
this.stopScan()
|
|
232
232
|
}}
|
|
233
|
-
>close</
|
|
233
|
+
>close</md-icon
|
|
234
234
|
>
|
|
235
235
|
`,
|
|
236
236
|
width: '100vw',
|
package/src/ox-input-code.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import { css, PropertyValues } from 'lit'
|
|
6
6
|
import { customElement, property } from 'lit/decorators.js'
|
|
7
7
|
|
|
8
|
+
import { minimalSetup } from 'codemirror'
|
|
8
9
|
import { history, historyKeymap, indentWithTab } from '@codemirror/commands'
|
|
9
|
-
import { EditorView, highlightActiveLine, keymap } from '@codemirror/view'
|
|
10
|
+
import { EditorView, highlightActiveLine, keymap, lineNumbers } from '@codemirror/view'
|
|
10
11
|
import { autocompletion, closeBrackets } from '@codemirror/autocomplete'
|
|
11
12
|
import { bracketMatching, LanguageSupport, syntaxHighlighting } from '@codemirror/language'
|
|
12
13
|
import { oneDarkHighlightStyle, oneDark } from '@codemirror/theme-one-dark'
|
|
@@ -25,7 +26,7 @@ WEB Component for code-mirror code editor.
|
|
|
25
26
|
|
|
26
27
|
Example:
|
|
27
28
|
|
|
28
|
-
<ox-input-code .value=${text}
|
|
29
|
+
<ox-input-code .value=${text} language="javascript" show-line-numbers>
|
|
29
30
|
</ox-input-code>
|
|
30
31
|
*/
|
|
31
32
|
@customElement('ox-input-code')
|
|
@@ -51,8 +52,7 @@ export class OxInputCode extends OxFormField {
|
|
|
51
52
|
* `value`는 에디터에서 작성중인 contents이다.
|
|
52
53
|
*/
|
|
53
54
|
@property({ type: String }) value: string = ''
|
|
54
|
-
@property({ type:
|
|
55
|
-
@property({ type: Boolean, attribute: 'tab-as-space' }) tabAsSpace: boolean = true
|
|
55
|
+
@property({ type: Boolean, attribute: 'show-line-numbers' }) showLineNumbers: boolean = false
|
|
56
56
|
@property({ type: String }) language?: string = 'javascript'
|
|
57
57
|
|
|
58
58
|
private _self_changing: boolean = false
|
|
@@ -88,7 +88,9 @@ export class OxInputCode extends OxFormField {
|
|
|
88
88
|
this._editor = new EditorView({
|
|
89
89
|
doc: this.value,
|
|
90
90
|
extensions: [
|
|
91
|
+
minimalSetup,
|
|
91
92
|
...language,
|
|
93
|
+
...(this.showLineNumbers ? [lineNumbers()] : []),
|
|
92
94
|
bracketMatching(),
|
|
93
95
|
closeBrackets(),
|
|
94
96
|
history(),
|
|
@@ -129,15 +131,6 @@ export class OxInputCode extends OxFormField {
|
|
|
129
131
|
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
|
130
132
|
})
|
|
131
133
|
|
|
132
|
-
// this._editor.contentDOM.addEventListener('change', async e => {
|
|
133
|
-
// this._self_changing = true
|
|
134
|
-
// this._changed = true
|
|
135
|
-
|
|
136
|
-
// await this.updateComplete
|
|
137
|
-
|
|
138
|
-
// this._self_changing = false
|
|
139
|
-
// })
|
|
140
|
-
|
|
141
134
|
return this._editor
|
|
142
135
|
}
|
|
143
136
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import '@material/
|
|
5
|
+
import '@material/web/icon/icon.js'
|
|
6
6
|
import '@operato/popup/ox-popup-list.js'
|
|
7
7
|
|
|
8
8
|
import { css, html, LitElement } from 'lit'
|
|
@@ -17,7 +17,7 @@ export class OxInputContainer extends LitElement {
|
|
|
17
17
|
render() {
|
|
18
18
|
return html`
|
|
19
19
|
<slot> </slot>
|
|
20
|
-
<
|
|
20
|
+
<md-icon @click=${this.openPopupList.bind(this)}>menu</md-icon>
|
|
21
21
|
|
|
22
22
|
<ox-popup-list></ox-popup-list>
|
|
23
23
|
`
|
package/src/ox-input-crontab.ts
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import '@material/mwc-button'
|
|
6
|
-
|
|
7
5
|
import { css, html, PropertyValues } from 'lit'
|
|
8
6
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
9
7
|
|
|
@@ -211,14 +209,12 @@ export class OxInputCrontab extends OxFormField {
|
|
|
211
209
|
margin: -0.25rem;
|
|
212
210
|
}
|
|
213
211
|
|
|
214
|
-
|
|
215
|
-
background-color: var(--secondary-color);
|
|
212
|
+
button {
|
|
216
213
|
border-radius: var(--button-border-radius);
|
|
217
|
-
--mdc-theme-primary: #fff;
|
|
218
214
|
margin: 0.25rem;
|
|
219
215
|
}
|
|
220
|
-
|
|
221
|
-
|
|
216
|
+
button:hover,
|
|
217
|
+
button:active {
|
|
222
218
|
background-color: var(--primary-color);
|
|
223
219
|
}
|
|
224
220
|
`
|
|
@@ -399,7 +395,7 @@ export class OxInputCrontab extends OxFormField {
|
|
|
399
395
|
}
|
|
400
396
|
|
|
401
397
|
get focusableElements(): HTMLElement[] {
|
|
402
|
-
return Array.from(this.renderRoot.querySelectorAll('select, input,
|
|
398
|
+
return Array.from(this.renderRoot.querySelectorAll('select, input, button'))
|
|
403
399
|
}
|
|
404
400
|
|
|
405
401
|
firstUpdated() {
|
package/src/ox-input-data.ts
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import './ox-input-code'
|
|
6
6
|
|
|
7
|
-
import { css, html
|
|
8
|
-
import { customElement
|
|
7
|
+
import { css, html } from 'lit'
|
|
8
|
+
import { customElement } from 'lit/decorators.js'
|
|
9
9
|
import { live } from 'lit/directives/live.js'
|
|
10
10
|
|
|
11
11
|
import { OxFormField } from './ox-form-field.js'
|
|
12
12
|
import { OxInputCode } from './ox-input-code.js'
|
|
13
|
+
import { isEqual } from 'lodash-es'
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
WEB Component for code-mirror based data editor.
|
|
@@ -37,7 +38,7 @@ export class OxInputData extends OxFormField {
|
|
|
37
38
|
font-size: small;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
div[datatype]
|
|
41
|
+
div[datatype] md-icon {
|
|
41
42
|
margin-left: auto;
|
|
42
43
|
}
|
|
43
44
|
|
|
@@ -87,10 +88,19 @@ export class OxInputData extends OxFormField {
|
|
|
87
88
|
/>
|
|
88
89
|
<label for="object">object</label>
|
|
89
90
|
|
|
90
|
-
<
|
|
91
|
+
<md-icon @click=${() => this._clearData()} title="delete">delete_forever</md-icon>
|
|
91
92
|
</div>
|
|
92
93
|
|
|
93
|
-
<ox-input-code
|
|
94
|
+
<ox-input-code
|
|
95
|
+
.value=${this._getStringData(this.value)}
|
|
96
|
+
language="text"
|
|
97
|
+
editor
|
|
98
|
+
?disabled=${this.disabled}
|
|
99
|
+
@change=${(e: CustomEvent) => {
|
|
100
|
+
e.stopPropagation()
|
|
101
|
+
this._setDataTypeAndValue(valueType, (e.target as any).value)
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
94
104
|
</ox-input-code>
|
|
95
105
|
`
|
|
96
106
|
}
|
|
@@ -109,29 +119,63 @@ export class OxInputData extends OxFormField {
|
|
|
109
119
|
})
|
|
110
120
|
}
|
|
111
121
|
|
|
122
|
+
_setDataTypeAndValue(type: string | undefined | null, value: any) {
|
|
123
|
+
/* value must be a string */
|
|
124
|
+
try {
|
|
125
|
+
switch (type) {
|
|
126
|
+
case 'number':
|
|
127
|
+
if (!isNaN(Number(value))) {
|
|
128
|
+
value = Number(value)
|
|
129
|
+
}
|
|
130
|
+
break
|
|
131
|
+
case 'object':
|
|
132
|
+
value = eval('(' + value + ')')
|
|
133
|
+
break
|
|
134
|
+
}
|
|
135
|
+
} catch (e) {}
|
|
136
|
+
|
|
137
|
+
if (isEqual(this.value, value)) {
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
this.value = value
|
|
142
|
+
|
|
143
|
+
this.requestUpdate()
|
|
144
|
+
this._onAfterValueChange()
|
|
145
|
+
}
|
|
146
|
+
|
|
112
147
|
_setDataType(type: string | undefined | null) {
|
|
113
|
-
if (typeof this.value
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
148
|
+
if (typeof this.value == type) {
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
var value = this.value
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
switch (type) {
|
|
156
|
+
case 'string':
|
|
157
|
+
value = this._getStringData(value)
|
|
158
|
+
break
|
|
159
|
+
case 'number':
|
|
160
|
+
if (!isNaN(value)) {
|
|
161
|
+
value = Number(value)
|
|
162
|
+
}
|
|
163
|
+
break
|
|
164
|
+
case 'object':
|
|
165
|
+
value = eval('(' + value + ')')
|
|
166
|
+
break
|
|
132
167
|
}
|
|
168
|
+
} catch (e) {
|
|
169
|
+
console.log(e)
|
|
133
170
|
}
|
|
134
171
|
|
|
172
|
+
if (isEqual(this.value, value)) {
|
|
173
|
+
this.requestUpdate()
|
|
174
|
+
return
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
this.value = value
|
|
178
|
+
|
|
135
179
|
this.requestUpdate()
|
|
136
180
|
this._onAfterValueChange()
|
|
137
181
|
}
|
package/src/ox-input-duration.ts
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import '@material/mwc-button'
|
|
6
|
-
|
|
7
5
|
import { css, html } from 'lit'
|
|
8
6
|
import { customElement, property, query } from 'lit/decorators.js'
|
|
9
7
|
|
|
@@ -28,9 +26,14 @@ export class OxInputDuration extends OxFormField {
|
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
form {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
|
|
32
|
+
align-items: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[padding] {
|
|
36
|
+
min-width: 100px;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
input {
|
|
@@ -65,18 +68,16 @@ export class OxInputDuration extends OxFormField {
|
|
|
65
68
|
border: var(--button-border);
|
|
66
69
|
border-radius: var(--border-radius);
|
|
67
70
|
background-color: var(--button-background-color);
|
|
68
|
-
padding: var(--padding-narrow) var(--padding-default);
|
|
69
71
|
min-height: 35px;
|
|
70
72
|
line-height: 0.8;
|
|
71
73
|
color: var(--button-color);
|
|
72
74
|
cursor: pointer;
|
|
73
75
|
}
|
|
76
|
+
|
|
74
77
|
button + button {
|
|
75
78
|
margin-left: -5px;
|
|
76
79
|
}
|
|
77
|
-
|
|
78
|
-
font-size: var(--fontsize-default);
|
|
79
|
-
}
|
|
80
|
+
|
|
80
81
|
button:focus,
|
|
81
82
|
button:hover,
|
|
82
83
|
button:active {
|
|
@@ -100,6 +101,7 @@ export class OxInputDuration extends OxFormField {
|
|
|
100
101
|
|
|
101
102
|
return html`
|
|
102
103
|
<form @change=${this.onChange.bind(this)}>
|
|
104
|
+
<div padding></div>
|
|
103
105
|
<input id="days" type="number" .value=${String(days || 0)} pattern="\\d*" ?disabled=${this.disabled} />
|
|
104
106
|
<label for="days">${i18next.t('label.days')}</label>
|
|
105
107
|
|
|
@@ -148,8 +150,9 @@ export class OxInputDuration extends OxFormField {
|
|
|
148
150
|
}}
|
|
149
151
|
?disabled=${this.disabled}
|
|
150
152
|
>
|
|
151
|
-
<
|
|
153
|
+
<md-icon>backspace</md-icon>
|
|
152
154
|
</button>
|
|
155
|
+
<div padding></div>
|
|
153
156
|
</form>
|
|
154
157
|
`
|
|
155
158
|
}
|
package/src/ox-input-file.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import '@material/
|
|
5
|
+
import '@material/web/icon/icon.js'
|
|
6
6
|
|
|
7
7
|
import { css, html, PropertyValues } from 'lit'
|
|
8
8
|
import { customElement, property, query } from 'lit/decorators.js'
|
|
@@ -32,9 +32,10 @@ export class OxInputFile extends OxFormField {
|
|
|
32
32
|
font: var(--file-uploader-font) !important;
|
|
33
33
|
color: var(--file-uploader-color);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
:host > md-icon {
|
|
36
37
|
color: var(--file-uploader-icon-color);
|
|
37
|
-
--
|
|
38
|
+
--md-icon-size: var(--file-uploader-icon-size, 36px);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
:host(.candrop) {
|
|
@@ -75,14 +76,14 @@ export class OxInputFile extends OxFormField {
|
|
|
75
76
|
border-bottom: var(--file-uploader-li-border-bottom);
|
|
76
77
|
font: normal 14px var(--theme-font);
|
|
77
78
|
}
|
|
78
|
-
li
|
|
79
|
+
li md-icon {
|
|
79
80
|
float: right;
|
|
80
81
|
cursor: pointer;
|
|
81
82
|
margin: var(--file-uploader-li-icon-margin);
|
|
82
83
|
font-size: 1em;
|
|
83
84
|
}
|
|
84
|
-
li
|
|
85
|
-
li
|
|
85
|
+
li md-icon:hover,
|
|
86
|
+
li md-icon:active {
|
|
86
87
|
color: var(--file-uploader-li-icon-focus-color);
|
|
87
88
|
}
|
|
88
89
|
`
|
|
@@ -104,7 +105,7 @@ export class OxInputFile extends OxFormField {
|
|
|
104
105
|
var files: File[] = this.value || []
|
|
105
106
|
|
|
106
107
|
return html`
|
|
107
|
-
<
|
|
108
|
+
<md-icon>${this.icon || 'upload'}</md-icon>
|
|
108
109
|
|
|
109
110
|
<span>${this.description || 'drop files here!'}</span>
|
|
110
111
|
|
|
@@ -127,7 +128,7 @@ export class OxInputFile extends OxFormField {
|
|
|
127
128
|
file => html`
|
|
128
129
|
<li>
|
|
129
130
|
- ${file.name}
|
|
130
|
-
<
|
|
131
|
+
<md-icon
|
|
131
132
|
@click=${(e: Event) => {
|
|
132
133
|
if (this.disabled) {
|
|
133
134
|
return
|
|
@@ -136,7 +137,7 @@ export class OxInputFile extends OxFormField {
|
|
|
136
137
|
this.value = [...files]
|
|
137
138
|
this._notifyChange()
|
|
138
139
|
}}
|
|
139
|
-
>delete_outline</
|
|
140
|
+
>delete_outline</md-icon
|
|
140
141
|
>
|
|
141
142
|
</li>
|
|
142
143
|
`
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@material/web/icon/icon.js'
|
|
6
|
+
|
|
7
|
+
import { css, html } from 'lit'
|
|
8
|
+
import { customElement, property, queryAll } from 'lit/decorators.js'
|
|
9
|
+
|
|
10
|
+
import { OxFormField } from './ox-form-field'
|
|
11
|
+
|
|
12
|
+
type I18nLabel = { [code: string]: string }
|
|
13
|
+
|
|
14
|
+
const LANGUAGES = [
|
|
15
|
+
{
|
|
16
|
+
code: 'en',
|
|
17
|
+
display: 'English'
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
input component for i18n labels
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
|
|
26
|
+
<ox-input-i18n-label
|
|
27
|
+
value=${map}
|
|
28
|
+
languages=${languages}
|
|
29
|
+
</ox-input-i18n-label>
|
|
30
|
+
*/
|
|
31
|
+
@customElement('ox-input-i18n-label')
|
|
32
|
+
export class OxInputI18nLabels extends OxFormField {
|
|
33
|
+
static styles = css`
|
|
34
|
+
:host {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
gap: 10px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[data-record] {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 10px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
label {
|
|
49
|
+
width: 80px;
|
|
50
|
+
text-align: end;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
input {
|
|
54
|
+
flex: 1;
|
|
55
|
+
border: 0;
|
|
56
|
+
border-bottom: var(--border-dark-color);
|
|
57
|
+
padding: var(--input-padding);
|
|
58
|
+
font: var(--input-font);
|
|
59
|
+
color: var(--primary-text-color);
|
|
60
|
+
min-width: 100px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
input:focus {
|
|
64
|
+
outline: none;
|
|
65
|
+
border-bottom: 1px solid var(--primary-color);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
input[type='hidden'] {
|
|
69
|
+
flex: 0;
|
|
70
|
+
}
|
|
71
|
+
`
|
|
72
|
+
|
|
73
|
+
@property({ type: Object }) value: I18nLabel = {}
|
|
74
|
+
@property({ type: Array }) languages: { display: string; code: string }[] = LANGUAGES
|
|
75
|
+
|
|
76
|
+
@queryAll('[data-record]') records!: NodeListOf<HTMLElement>
|
|
77
|
+
|
|
78
|
+
private changing: boolean = false
|
|
79
|
+
|
|
80
|
+
firstUpdated() {
|
|
81
|
+
this.renderRoot.addEventListener('change', this.onChange.bind(this))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
render() {
|
|
85
|
+
const value = !this.value || typeof this.value !== 'object' ? {} : this.value
|
|
86
|
+
const languages = (this.languages && this.languages.length > 0 && this.languages) || LANGUAGES
|
|
87
|
+
|
|
88
|
+
return html`
|
|
89
|
+
${languages.map(
|
|
90
|
+
({ display, code }) => html`
|
|
91
|
+
<div data-record>
|
|
92
|
+
<label>${display}</label>
|
|
93
|
+
<input type="hidden" data-code value=${code} />
|
|
94
|
+
<input
|
|
95
|
+
type="text"
|
|
96
|
+
data-label
|
|
97
|
+
placeholder="label"
|
|
98
|
+
.value=${value?.[code] || ''}
|
|
99
|
+
?disabled=${this.disabled}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
`
|
|
103
|
+
)}
|
|
104
|
+
`
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private onChange(e: Event) {
|
|
108
|
+
e.stopPropagation()
|
|
109
|
+
|
|
110
|
+
if (this.changing) {
|
|
111
|
+
return
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
this.changing = true
|
|
115
|
+
|
|
116
|
+
this.build()
|
|
117
|
+
|
|
118
|
+
this.changing = false
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private build() {
|
|
122
|
+
var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>
|
|
123
|
+
|
|
124
|
+
var newmap: I18nLabel = {}
|
|
125
|
+
|
|
126
|
+
for (var i = 0; i < records.length; i++) {
|
|
127
|
+
var record = records[i]
|
|
128
|
+
|
|
129
|
+
const code = (record.querySelector('[data-code]') as HTMLInputElement).value
|
|
130
|
+
const label = (record.querySelector('[data-label]') as HTMLInputElement).value
|
|
131
|
+
|
|
132
|
+
if (code) {
|
|
133
|
+
newmap[code] = label || ''
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
this.value = { ...this.value, ...newmap }
|
|
138
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
|
139
|
+
}
|
|
140
|
+
}
|