@operato/input 7.0.0-rc.9 → 7.0.0

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.
Files changed (177) hide show
  1. package/.storybook/preview.js +52 -0
  2. package/CHANGELOG.md +36 -0
  3. package/dist/src/ox-input-crontab.js +1 -1
  4. package/dist/src/ox-input-crontab.js.map +1 -1
  5. package/dist/src/ox-input-duration.js +2 -2
  6. package/dist/src/ox-input-duration.js.map +1 -1
  7. package/dist/src/ox-input-hashtags.js +2 -2
  8. package/dist/src/ox-input-hashtags.js.map +1 -1
  9. package/dist/src/ox-input-key-values.js +3 -3
  10. package/dist/src/ox-input-key-values.js.map +1 -1
  11. package/dist/src/ox-input-mass-fraction.js +2 -2
  12. package/dist/src/ox-input-mass-fraction.js.map +1 -1
  13. package/dist/src/ox-input-options.js +2 -2
  14. package/dist/src/ox-input-options.js.map +1 -1
  15. package/dist/src/ox-input-partition-keys.js +3 -3
  16. package/dist/src/ox-input-partition-keys.js.map +1 -1
  17. package/dist/src/ox-input-unit-number.js +1 -1
  18. package/dist/src/ox-input-unit-number.js.map +1 -1
  19. package/dist/src/ox-input-value-map.js +3 -3
  20. package/dist/src/ox-input-value-map.js.map +1 -1
  21. package/dist/src/ox-input-value-ranges.js +3 -3
  22. package/dist/src/ox-input-value-ranges.js.map +1 -1
  23. package/dist/src/ox-input-work-shift.js +3 -3
  24. package/dist/src/ox-input-work-shift.js.map +1 -1
  25. package/dist/stories/ox-buttons-radio.stories.d.ts +0 -5
  26. package/dist/stories/ox-buttons-radio.stories.js +3 -9
  27. package/dist/stories/ox-buttons-radio.stories.js.map +1 -1
  28. package/dist/stories/ox-checkbox.stories.d.ts +0 -5
  29. package/dist/stories/ox-checkbox.stories.js +3 -9
  30. package/dist/stories/ox-checkbox.stories.js.map +1 -1
  31. package/dist/stories/ox-input-3axis.stories.d.ts +0 -5
  32. package/dist/stories/ox-input-3axis.stories.js +2 -7
  33. package/dist/stories/ox-input-3axis.stories.js.map +1 -1
  34. package/dist/stories/ox-input-3dish.stories.d.ts +0 -5
  35. package/dist/stories/ox-input-3dish.stories.js +2 -7
  36. package/dist/stories/ox-input-3dish.stories.js.map +1 -1
  37. package/dist/stories/ox-input-angle.stories.d.ts +0 -5
  38. package/dist/stories/ox-input-angle.stories.js +2 -7
  39. package/dist/stories/ox-input-angle.stories.js.map +1 -1
  40. package/dist/stories/ox-input-barcode.stories.d.ts +0 -5
  41. package/dist/stories/ox-input-barcode.stories.js +2 -7
  42. package/dist/stories/ox-input-barcode.stories.js.map +1 -1
  43. package/dist/stories/ox-input-code.stories.d.ts +0 -5
  44. package/dist/stories/ox-input-code.stories.js +2 -7
  45. package/dist/stories/ox-input-code.stories.js.map +1 -1
  46. package/dist/stories/ox-input-crontab.stories.d.ts +0 -5
  47. package/dist/stories/ox-input-crontab.stories.js +2 -7
  48. package/dist/stories/ox-input-crontab.stories.js.map +1 -1
  49. package/dist/stories/ox-input-data.stories.d.ts +0 -5
  50. package/dist/stories/ox-input-data.stories.js +2 -8
  51. package/dist/stories/ox-input-data.stories.js.map +1 -1
  52. package/dist/stories/ox-input-direction.stories.d.ts +0 -5
  53. package/dist/stories/ox-input-direction.stories.js +2 -7
  54. package/dist/stories/ox-input-direction.stories.js.map +1 -1
  55. package/dist/stories/ox-input-duration.stories.d.ts +0 -5
  56. package/dist/stories/ox-input-duration.stories.js +2 -7
  57. package/dist/stories/ox-input-duration.stories.js.map +1 -1
  58. package/dist/stories/ox-input-file.stories.d.ts +0 -5
  59. package/dist/stories/ox-input-file.stories.js +2 -7
  60. package/dist/stories/ox-input-file.stories.js.map +1 -1
  61. package/dist/stories/ox-input-hashtags.stories.d.ts +0 -5
  62. package/dist/stories/ox-input-hashtags.stories.js +2 -7
  63. package/dist/stories/ox-input-hashtags.stories.js.map +1 -1
  64. package/dist/stories/ox-input-i18n-label.stories.d.ts +0 -5
  65. package/dist/stories/ox-input-i18n-label.stories.js +2 -7
  66. package/dist/stories/ox-input-i18n-label.stories.js.map +1 -1
  67. package/dist/stories/ox-input-key-values.stories.d.ts +0 -5
  68. package/dist/stories/ox-input-key-values.stories.js +2 -7
  69. package/dist/stories/ox-input-key-values.stories.js.map +1 -1
  70. package/dist/stories/ox-input-mass-fraction.stories.d.ts +0 -5
  71. package/dist/stories/ox-input-mass-fraction.stories.js +2 -7
  72. package/dist/stories/ox-input-mass-fraction.stories.js.map +1 -1
  73. package/dist/stories/ox-input-multiple-colors.stories.d.ts +0 -5
  74. package/dist/stories/ox-input-multiple-colors.stories.js +2 -7
  75. package/dist/stories/ox-input-multiple-colors.stories.js.map +1 -1
  76. package/dist/stories/ox-input-options.stories.d.ts +0 -5
  77. package/dist/stories/ox-input-options.stories.js +2 -7
  78. package/dist/stories/ox-input-options.stories.js.map +1 -1
  79. package/dist/stories/ox-input-partition-keys.stories.d.ts +0 -5
  80. package/dist/stories/ox-input-partition-keys.stories.js +2 -7
  81. package/dist/stories/ox-input-partition-keys.stories.js.map +1 -1
  82. package/dist/stories/ox-input-privilege.stories.d.ts +0 -5
  83. package/dist/stories/ox-input-privilege.stories.js +2 -7
  84. package/dist/stories/ox-input-privilege.stories.js.map +1 -1
  85. package/dist/stories/ox-input-quantifier.stories.d.ts +0 -5
  86. package/dist/stories/ox-input-quantifier.stories.js +2 -7
  87. package/dist/stories/ox-input-quantifier.stories.js.map +1 -1
  88. package/dist/stories/ox-input-range.stories.d.ts +0 -5
  89. package/dist/stories/ox-input-range.stories.js +2 -7
  90. package/dist/stories/ox-input-range.stories.js.map +1 -1
  91. package/dist/stories/ox-input-search.stories.d.ts +0 -5
  92. package/dist/stories/ox-input-search.stories.js +2 -7
  93. package/dist/stories/ox-input-search.stories.js.map +1 -1
  94. package/dist/stories/ox-input-select-buttons.stories.d.ts +0 -5
  95. package/dist/stories/ox-input-select-buttons.stories.js +2 -7
  96. package/dist/stories/ox-input-select-buttons.stories.js.map +1 -1
  97. package/dist/stories/ox-input-table-column-config.stories.d.ts +0 -5
  98. package/dist/stories/ox-input-table-column-config.stories.js +2 -7
  99. package/dist/stories/ox-input-table-column-config.stories.js.map +1 -1
  100. package/dist/stories/ox-input-unit.stories.d.ts +0 -5
  101. package/dist/stories/ox-input-unit.stories.js +2 -7
  102. package/dist/stories/ox-input-unit.stories.js.map +1 -1
  103. package/dist/stories/ox-input-value-map.stories.d.ts +0 -5
  104. package/dist/stories/ox-input-value-map.stories.js +2 -7
  105. package/dist/stories/ox-input-value-map.stories.js.map +1 -1
  106. package/dist/stories/ox-input-value-ranges.stories.d.ts +0 -5
  107. package/dist/stories/ox-input-value-ranges.stories.js +2 -7
  108. package/dist/stories/ox-input-value-ranges.stories.js.map +1 -1
  109. package/dist/stories/ox-input-work-shift.stories.d.ts +0 -5
  110. package/dist/stories/ox-input-work-shift.stories.js +2 -7
  111. package/dist/stories/ox-input-work-shift.stories.js.map +1 -1
  112. package/dist/stories/ox-select-set-options.stories.d.ts +0 -5
  113. package/dist/stories/ox-select-set-options.stories.js +2 -7
  114. package/dist/stories/ox-select-set-options.stories.js.map +1 -1
  115. package/dist/stories/ox-select.stories.d.ts +0 -5
  116. package/dist/stories/ox-select.stories.js +2 -7
  117. package/dist/stories/ox-select.stories.js.map +1 -1
  118. package/dist/tsconfig.tsbuildinfo +1 -1
  119. package/package.json +7 -7
  120. package/src/ox-input-crontab.ts +1 -1
  121. package/src/ox-input-duration.ts +2 -2
  122. package/src/ox-input-hashtags.ts +2 -2
  123. package/src/ox-input-key-values.ts +3 -3
  124. package/src/ox-input-mass-fraction.ts +2 -2
  125. package/src/ox-input-options.ts +2 -2
  126. package/src/ox-input-partition-keys.ts +3 -3
  127. package/src/ox-input-unit-number.ts +1 -1
  128. package/src/ox-input-value-map.ts +3 -3
  129. package/src/ox-input-value-ranges.ts +3 -3
  130. package/src/ox-input-work-shift.ts +3 -3
  131. package/stories/ox-buttons-radio.stories.ts +3 -10
  132. package/stories/ox-checkbox.stories.ts +3 -12
  133. package/stories/ox-input-3axis.stories.ts +2 -8
  134. package/stories/ox-input-3dish.stories.ts +2 -8
  135. package/stories/ox-input-angle.stories.ts +2 -8
  136. package/stories/ox-input-barcode.stories.ts +2 -9
  137. package/stories/ox-input-code.stories.ts +2 -9
  138. package/stories/ox-input-crontab.stories.ts +2 -13
  139. package/stories/ox-input-data.stories.ts +2 -9
  140. package/stories/ox-input-direction.stories.ts +2 -8
  141. package/stories/ox-input-duration.stories.ts +2 -8
  142. package/stories/ox-input-file.stories.ts +2 -9
  143. package/stories/ox-input-hashtags.stories.ts +2 -14
  144. package/stories/ox-input-i18n-label.stories.ts +2 -8
  145. package/stories/ox-input-key-values.stories.ts +2 -14
  146. package/stories/ox-input-mass-fraction.stories.ts +2 -9
  147. package/stories/ox-input-multiple-colors.stories.ts +2 -8
  148. package/stories/ox-input-options.stories.ts +2 -8
  149. package/stories/ox-input-partition-keys.stories.ts +2 -13
  150. package/stories/ox-input-privilege.stories.ts +2 -14
  151. package/stories/ox-input-quantifier.stories.ts +2 -8
  152. package/stories/ox-input-range.stories.ts +2 -9
  153. package/stories/ox-input-search.stories.ts +2 -9
  154. package/stories/ox-input-select-buttons.stories.ts +2 -9
  155. package/stories/ox-input-table-column-config.stories.ts +2 -13
  156. package/stories/ox-input-unit.stories.ts +2 -9
  157. package/stories/ox-input-value-map.stories.ts +2 -9
  158. package/stories/ox-input-value-ranges.stories.ts +2 -9
  159. package/stories/ox-input-work-shift.stories.ts +2 -8
  160. package/stories/ox-select-set-options.stories.ts +2 -9
  161. package/stories/ox-select.stories.ts +2 -9
  162. package/themes/app-theme.css +138 -0
  163. package/themes/calendar-theme.css +59 -0
  164. package/themes/dark.css +0 -100
  165. package/themes/grist-theme.css +44 -40
  166. package/themes/layout-theme.css +94 -0
  167. package/themes/light.css +3 -103
  168. package/themes/material-theme.css +23 -0
  169. package/themes/oops-theme.css +22 -0
  170. package/themes/report-theme.css +47 -0
  171. package/themes/spacing.css +7 -27
  172. package/themes/state-color.css +1 -1
  173. package/themes/tooltip-theme.css +11 -0
  174. package/themes/dark-hc.css +0 -151
  175. package/themes/dark-mc.css +0 -151
  176. package/themes/light-hc.css +0 -151
  177. package/themes/light-mc.css +0 -151
@@ -0,0 +1,52 @@
1
+ import { i18next } from '@operato/i18n'
2
+
3
+ export const globalTypes = {
4
+ locale: {
5
+ name: 'Locale',
6
+ description: 'Internationalization locale',
7
+ toolbar: {
8
+ icon: 'globe',
9
+ items: [
10
+ { value: 'en', right: '🇺🇸', title: 'English' },
11
+ { value: 'ko', right: '🇰🇷', title: '한국어' },
12
+ { value: 'zh', right: '🇨🇳', title: '中文' },
13
+ { value: 'ja', right: '🇯🇵', title: '日本語' },
14
+ { value: 'ms', right: '🇲🇾', title: 'Bahasa Melayu' }
15
+ ],
16
+ showName: true
17
+ }
18
+ },
19
+ theme: {
20
+ name: 'Theme',
21
+ description: 'Global theme for components',
22
+ toolbar: {
23
+ icon: 'paintbrush',
24
+ items: [
25
+ { value: 'light', title: 'Light' },
26
+ { value: 'dark', title: 'Dark' }
27
+ ],
28
+ showName: true
29
+ }
30
+ }
31
+ }
32
+
33
+ export const decorators = [
34
+ (Story, context) => {
35
+ const { locale, theme } = context.globals
36
+
37
+ if (locale) {
38
+ i18next.changeLanguage(locale)
39
+ }
40
+
41
+ // Set the theme class for the document
42
+ if (theme === 'dark') {
43
+ document.documentElement.classList.add('dark')
44
+ document.documentElement.classList.remove('light')
45
+ } else {
46
+ document.documentElement.classList.add('light')
47
+ document.documentElement.classList.remove('dark')
48
+ }
49
+
50
+ return Story()
51
+ }
52
+ ]
package/CHANGELOG.md CHANGED
@@ -3,6 +3,42 @@
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.0.0](https://github.com/hatiolab/operato/compare/v7.0.0-rc.13...v7.0.0) (2024-06-30)
7
+
8
+ **Note:** Version bump only for package @operato/input
9
+
10
+
11
+
12
+
13
+
14
+ ## [7.0.0-rc.13](https://github.com/hatiolab/operato/compare/v7.0.0-rc.12...v7.0.0-rc.13) (2024-06-30)
15
+
16
+
17
+ ### :bug: Bug Fix
18
+
19
+ * storybook preview.js ([84d7682](https://github.com/hatiolab/operato/commit/84d7682af452554e8b0e83aa683bdc3726e264bb))
20
+ * storybook preview.js ([c2e4f7b](https://github.com/hatiolab/operato/commit/c2e4f7babc46067fef8c0d47481ee2351fe77917))
21
+ * storybook preview.js ([8ed7305](https://github.com/hatiolab/operato/commit/8ed73059fd5b03718dc44e7b984cd47f4316c7da))
22
+
23
+
24
+
25
+ ## [7.0.0-rc.11](https://github.com/hatiolab/operato/compare/v7.0.0-rc.10...v7.0.0-rc.11) (2024-06-29)
26
+
27
+
28
+ ### :bug: Bug Fix
29
+
30
+ * material design token ([bf70a97](https://github.com/hatiolab/operato/commit/bf70a9783aacfd6f58e945515d25120ace1ad1f3))
31
+
32
+
33
+
34
+ ## [7.0.0-rc.10](https://github.com/hatiolab/operato/compare/v7.0.0-rc.9...v7.0.0-rc.10) (2024-06-29)
35
+
36
+ **Note:** Version bump only for package @operato/input
37
+
38
+
39
+
40
+
41
+
6
42
  ## [7.0.0-rc.9](https://github.com/hatiolab/operato/compare/v7.0.0-rc.8...v7.0.0-rc.9) (2024-06-29)
7
43
 
8
44
 
@@ -142,7 +142,7 @@ let OxInputCrontab = class OxInputCrontab extends OxFormField {
142
142
 
143
143
  input:invalid {
144
144
  border-color: var(--md-sys-color-error);
145
- color: var(--status-danger-color);
145
+ color: var(--md-sys-color-error);
146
146
  }
147
147
 
148
148
  label {
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-crontab.js","sourceRoot":"","sources":["../../src/ox-input-crontab.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;A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yValues } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field'\n\nfunction createCronRegex(type: 'sec' | 'min' | 'hour' | 'day' | 'month' | 'dayOfWeek') {\n // https://gist.github.com/dkandalov/a2aed17cfdeb65243022\n var regexByField = {} as any\n regexByField['sec'] = '[0-5]?\\\\d'\n regexByField['min'] = '[0-5]?\\\\d'\n regexByField['hour'] = '[01]?\\\\d|2[0-3]'\n regexByField['day'] = '0?[1-9]|[12]\\\\d|3[01]'\n regexByField['month'] = '[1-9]|1[012]'\n regexByField['dayOfWeek'] = '[0-7]'\n\n var crontabFields = [type]\n if (!type) crontabFields = ['sec', 'min', 'hour', 'day', 'month', 'dayOfWeek']\n\n crontabFields.forEach(field => {\n var number = regexByField[field]\n var range =\n '(?:' +\n number +\n ')' +\n '(?:' +\n '(?:-|/|,' +\n ('dayOfWeek' === field ? '|#' : '') +\n ')' +\n '(?:' +\n number +\n ')' +\n ')?'\n if (field === 'dayOfWeek') range += '(?:L)?'\n if (field === 'month') range += '(?:L|W)?'\n regexByField[field] = '\\\\?|\\\\*|' + range + '(?:,' + range + ')*'\n })\n\n var monthValues = 'JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC'\n var monthRange = '(?:' + monthValues + ')(?:(?:-)(?:' + monthValues + '))?'\n regexByField['month'] += '|\\\\?|\\\\*|' + monthRange + '(?:,' + monthRange + ')*'\n\n var dayOfWeekValues = 'MON|TUE|WED|THU|FRI|SAT|SUN'\n var dayOfWeekRange = '(?:' + dayOfWeekValues + ')(?:(?:-)(?:' + dayOfWeekValues + '))?'\n regexByField['dayOfWeek'] += '|\\\\?|\\\\*|' + dayOfWeekRange + '(?:,' + dayOfWeekRange + ')*'\n\n if (!type)\n return (\n '^\\\\s*($' +\n '|#' +\n '|\\\\w+\\\\s*=' +\n '|' +\n '(' +\n regexByField['sec'] +\n ')\\\\s+' +\n '(' +\n regexByField['min'] +\n ')\\\\s+' +\n '(' +\n regexByField['hour'] +\n ')\\\\s+' +\n '(' +\n regexByField['day'] +\n ')\\\\s+' +\n '(' +\n regexByField['month'] +\n ')\\\\s+' +\n '(' +\n regexByField['dayOfWeek'] +\n ')(|\\\\s)+' +\n ')$'\n )\n else return `^${regexByField[type]}$`\n}\n\n@customElement('ox-input-crontab')\nexport class OxInputCrontab extends OxFormField {\n static styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n border: 0;\n }\n\n :host * {\n box-sizing: border-box;\n }\n :host *:focus {\n outline: none;\n }\n\n form {\n display: grid;\n width: 100%;\n height: 100%;\n padding: 1rem;\n grid-template: auto auto 1fr auto / repeat(6, 1fr);\n grid-gap: 0.5rem;\n justify-content: center;\n align-items: center;\n overflow: auto;\n }\n\n label[for='example'] {\n text-align: right;\n grid-column: 3;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n text-transform: capitalize;\n }\n\n #example {\n grid-column: 4 / span 3;\n width: 100%;\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n background-color: var(--md-sys-color-on-primary);\n text-transform: capitalize;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n input {\n width: 100%;\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n background-color: var(--md-sys-color-on-primary);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n input:focus {\n outline: none;\n border-color: var(--md-sys-color-secondary-fixed-dim);\n }\n\n input:invalid {\n border-color: var(--md-sys-color-error);\n color: var(--status-danger-color);\n }\n\n label {\n width: 100%;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n label:not([for='example']) {\n text-align: center;\n }\n\n #input-wrapper {\n grid-column: span 6;\n display: flex;\n flex-wrap: wrap;\n margin: 0 -0.25rem;\n }\n\n #input-wrapper > div {\n flex: 1;\n display: grid;\n grid-template-rows: 1fr auto;\n grid-gap: var(--spacing-small);\n min-width: 60px;\n max-width: 33%;\n margin: 0.25rem;\n }\n\n #tooltip {\n grid-column: span 6;\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: 0;\n margin: auto;\n grid-auto-rows: min-content;\n align-self: center;\n align-items: center;\n }\n\n #tooltip > div {\n padding: 0.25rem 0.5rem;\n border-bottom: var(--md-sys-color-on-surface-variant) 1px dashed;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n #tooltip > .crontab-value {\n text-align: right;\n color: var(--md-sys-color-surface-tint);\n }\n\n #tooltip > .crontab-description {\n text-align: left;\n color: var(--md-sys-color-on-primary-container);\n }\n\n #button-wrapper {\n grid-column: 1 / span 6;\n display: flex;\n flex-wrap: wrap-reverse;\n flex-direction: row-reverse;\n margin: -0.25rem;\n }\n\n button {\n border-radius: var(--button-border-radius);\n margin: 0.25rem;\n }\n button:hover,\n button:active {\n background-color: var(--md-sys-color-on-primary-container);\n }\n `\n\n @property({ type: String }) value?: string\n @property({ type: String }) second?: string\n @property({ type: String }) minute?: string\n @property({ type: String }) hour?: string\n @property({ type: String }) dayOfMonth?: string\n @property({ type: String }) month?: string\n @property({ type: String }) dayOfWeek?: string\n\n @state() tooltip: { value: string; description: string }[] = []\n\n render() {\n return html`\n <form>\n <label for=\"example\">${i18next.t('label.examples')}</label>\n <select\n id=\"example\"\n @change=${(e: Event) => (this.value = (e.currentTarget as HTMLInputElement).value)}\n .value=${this.value || ''}\n >\n <optgroup label=\"String(${i18next.t('label.second by second')})\">\n <option value=\"* * * * * *\">${i18next.t('text.every second')}</option>\n <option value=\"0/2 * * * * *\">${i18next.t('text.every 2 seconds')}</option>\n <option value=\"0/15 * * * * *\">${i18next.t('text.every 15 seconds')}</option>\n <option value=\"0/30 * * * * *\">${i18next.t('text.every 30 seconds')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.minute by minute')})\">\n <option value=\"0 * * * * *\">${i18next.t('text.every minute')}</option>\n <option value=\"0 0/2 * * * *\">${i18next.t('text.every 2 minutes')}</option>\n <option value=\"0 0/15 * * * *\">${i18next.t('text.every 15 minutes')}</option>\n <option value=\"0 0/30 * * * *\">${i18next.t('text.every half hour')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.hourly')})\">\n <option value=\"0 0 * * * *\">${i18next.t('text.every hour')}</option>\n <option value=\"0 0 0/2 * * *\">${i18next.t('text.every 2 hours')}</option>\n <option value=\"0 0 0/12 * * *\">${i18next.t('text.every 12 hours')}</option>\n <option value=\"0 0 10-19 * * *\">${i18next.t('text.every hour during working time')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.daily')})\">\n <option value=\"0 0 0 * * *\">${i18next.t('text.every day')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.weekly')})\">\n <option value=\"0 0 0 * * SUN\">${i18next.t('text.every sunday')}</option>\n <option value=\"0 0 0 * * 0\">${i18next.t('text.every sunday')}(2)</option>\n <option value=\"0 0 0 * * 1-5\">${i18next.t('text.every weekday')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.monthly')})\">\n <option value=\"0 0 0 1 * *\">${i18next.t('text.the first day of every month')}</option>\n <option value=\"0 0 10 21 * *\">${i18next.t('text.10 am on every payday')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.yearly')})\">\n <option value=\"0 0 0 1 1 *\">${i18next.t('text.the first day of every year')}</option>\n <option value=\"0 0 0 25 12 *\">${i18next.t('text.every christmas')}</option>\n </optgroup>\n </select>\n <div id=\"input-wrapper\">\n <div>\n <input\n id=\"second-input\"\n class=\"second\"\n type=\"text\"\n .value=${this.second || ''}\n @input=${(e: Event) => (this.second = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('second')\n }}\n pattern=${createCronRegex('sec')}\n required\n />\n <label for=\"second-input\" class=\"second\">${i18next.t('label.second')}</label>\n </div>\n <div>\n <input\n id=\"minute-input\"\n class=\"minute\"\n type=\"text\"\n .value=${this.minute || ''}\n @input=${(e: Event) => (this.minute = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('minute')\n }}\n pattern=${createCronRegex('min')}\n required\n />\n <label for=\"minute-input\" class=\"minute\">${i18next.t('label.minute')}</label>\n </div>\n <div>\n <input\n id=\"hour-input\"\n class=\"hour\"\n type=\"text\"\n .value=${this.hour || ''}\n @input=${(e: Event) => (this.hour = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('hour')\n }}\n pattern=${createCronRegex('hour')}\n required\n />\n <label for=\"hour-input\" class=\"hour\">${i18next.t('label.hour')}</label>\n </div>\n <div>\n <input\n id=\"day-of-month-input\"\n class=\"day-of-month\"\n type=\"text\"\n .value=${this.dayOfMonth || ''}\n @input=${(e: Event) => (this.dayOfMonth = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('dayOfMonth')\n }}\n pattern=${createCronRegex('day')}\n required\n />\n <label for=\"day-of-month-input\" class=\"day-of-month\">${i18next.t('label.day-of-month')}</label>\n </div>\n <div>\n <input\n id=\"month-input\"\n class=\"month\"\n type=\"text\"\n .value=${this.month || ''}\n @input=${(e: Event) => (this.month = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('month')\n }}\n pattern=${createCronRegex('month')}\n required\n />\n <label for=\"month-input\" class=\"month\">${i18next.t('label.month')}</label>\n </div>\n <div>\n <input\n id=\"day-of-week-input\"\n class=\"day-of-week\"\n type=\"text\"\n .value=${this.dayOfWeek || ''}\n @input=${(e: Event) => (this.dayOfWeek = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('dayOfWeek')\n }}\n pattern=${createCronRegex('dayOfWeek')}\n required\n />\n <label for=\"day-of-week-input\" class=\"day-of-week\">${i18next.t('label.day-of-week')}</label>\n </div>\n </div>\n <div id=\"tooltip\">\n ${this.tooltip.map(\n tip => html`\n <div class=\"crontab-value\">${tip.value}</div>\n <div class=\"crontab-description\">${i18next.t(`text.${tip.description}`)}</div>\n `\n )}\n </div>\n <button\n id=\"clear\"\n @click=${(e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n this.value = ''\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n >\n Clear\n </button>\n </form>\n `\n }\n\n get focusableElements(): HTMLElement[] {\n return Array.from(this.renderRoot.querySelectorAll('select, input, button'))\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n this.renderRoot.addEventListener('change', this.onChange.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n var values = (this.value || '').split(' ')\n\n if (values.length == 1) values = ['*', '*', '*', '*', '*', '*']\n else if (values.length == 5) values = ['0'].concat(values)\n\n this.second = values[0]\n this.minute = values[1]\n this.hour = values[2]\n this.dayOfMonth = values[3]\n this.month = values[4]\n this.dayOfWeek = values[5]\n }\n }\n\n showTooltip(type: 'second' | 'minute' | 'hour' | 'dayOfMonth' | 'month' | 'dayOfWeek') {\n switch (type) {\n case 'second':\n case 'minute':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-59',\n description: 'allowed values'\n }\n ]\n break\n case 'hour':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-23',\n description: 'allowed values'\n }\n ]\n break\n\n case 'dayOfMonth':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '1-31',\n description: 'allowed values'\n }\n ]\n break\n\n case 'month':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '1-12',\n description: 'allowed values'\n },\n {\n value: 'JAN-DEC',\n description: 'alternative single values'\n }\n ]\n break\n\n case 'dayOfWeek':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-6',\n description: 'allowed values'\n },\n {\n value: 'SUN-SAT',\n description: 'alternative single values'\n }\n ]\n break\n\n default:\n this.tooltip = []\n break\n }\n }\n\n onChange() {\n var form = this.renderRoot.querySelector('form') as HTMLFormElement\n var valid = form.checkValidity()\n if (!valid) {\n form.reportValidity()\n return\n }\n\n this.value = `${this.second} ${this.minute} ${this.hour} ${this.dayOfMonth} ${this.month} ${this.dayOfWeek}`\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-crontab.js","sourceRoot":"","sources":["../../src/ox-input-crontab.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,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\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field'\n\nfunction createCronRegex(type: 'sec' | 'min' | 'hour' | 'day' | 'month' | 'dayOfWeek') {\n // https://gist.github.com/dkandalov/a2aed17cfdeb65243022\n var regexByField = {} as any\n regexByField['sec'] = '[0-5]?\\\\d'\n regexByField['min'] = '[0-5]?\\\\d'\n regexByField['hour'] = '[01]?\\\\d|2[0-3]'\n regexByField['day'] = '0?[1-9]|[12]\\\\d|3[01]'\n regexByField['month'] = '[1-9]|1[012]'\n regexByField['dayOfWeek'] = '[0-7]'\n\n var crontabFields = [type]\n if (!type) crontabFields = ['sec', 'min', 'hour', 'day', 'month', 'dayOfWeek']\n\n crontabFields.forEach(field => {\n var number = regexByField[field]\n var range =\n '(?:' +\n number +\n ')' +\n '(?:' +\n '(?:-|/|,' +\n ('dayOfWeek' === field ? '|#' : '') +\n ')' +\n '(?:' +\n number +\n ')' +\n ')?'\n if (field === 'dayOfWeek') range += '(?:L)?'\n if (field === 'month') range += '(?:L|W)?'\n regexByField[field] = '\\\\?|\\\\*|' + range + '(?:,' + range + ')*'\n })\n\n var monthValues = 'JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC'\n var monthRange = '(?:' + monthValues + ')(?:(?:-)(?:' + monthValues + '))?'\n regexByField['month'] += '|\\\\?|\\\\*|' + monthRange + '(?:,' + monthRange + ')*'\n\n var dayOfWeekValues = 'MON|TUE|WED|THU|FRI|SAT|SUN'\n var dayOfWeekRange = '(?:' + dayOfWeekValues + ')(?:(?:-)(?:' + dayOfWeekValues + '))?'\n regexByField['dayOfWeek'] += '|\\\\?|\\\\*|' + dayOfWeekRange + '(?:,' + dayOfWeekRange + ')*'\n\n if (!type)\n return (\n '^\\\\s*($' +\n '|#' +\n '|\\\\w+\\\\s*=' +\n '|' +\n '(' +\n regexByField['sec'] +\n ')\\\\s+' +\n '(' +\n regexByField['min'] +\n ')\\\\s+' +\n '(' +\n regexByField['hour'] +\n ')\\\\s+' +\n '(' +\n regexByField['day'] +\n ')\\\\s+' +\n '(' +\n regexByField['month'] +\n ')\\\\s+' +\n '(' +\n regexByField['dayOfWeek'] +\n ')(|\\\\s)+' +\n ')$'\n )\n else return `^${regexByField[type]}$`\n}\n\n@customElement('ox-input-crontab')\nexport class OxInputCrontab extends OxFormField {\n static styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n border: 0;\n }\n\n :host * {\n box-sizing: border-box;\n }\n :host *:focus {\n outline: none;\n }\n\n form {\n display: grid;\n width: 100%;\n height: 100%;\n padding: 1rem;\n grid-template: auto auto 1fr auto / repeat(6, 1fr);\n grid-gap: 0.5rem;\n justify-content: center;\n align-items: center;\n overflow: auto;\n }\n\n label[for='example'] {\n text-align: right;\n grid-column: 3;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n text-transform: capitalize;\n }\n\n #example {\n grid-column: 4 / span 3;\n width: 100%;\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n background-color: var(--md-sys-color-on-primary);\n text-transform: capitalize;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n input {\n width: 100%;\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n background-color: var(--md-sys-color-on-primary);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n input:focus {\n outline: none;\n border-color: var(--md-sys-color-secondary-fixed-dim);\n }\n\n input:invalid {\n border-color: var(--md-sys-color-error);\n color: var(--md-sys-color-error);\n }\n\n label {\n width: 100%;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n label:not([for='example']) {\n text-align: center;\n }\n\n #input-wrapper {\n grid-column: span 6;\n display: flex;\n flex-wrap: wrap;\n margin: 0 -0.25rem;\n }\n\n #input-wrapper > div {\n flex: 1;\n display: grid;\n grid-template-rows: 1fr auto;\n grid-gap: var(--spacing-small);\n min-width: 60px;\n max-width: 33%;\n margin: 0.25rem;\n }\n\n #tooltip {\n grid-column: span 6;\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: 0;\n margin: auto;\n grid-auto-rows: min-content;\n align-self: center;\n align-items: center;\n }\n\n #tooltip > div {\n padding: 0.25rem 0.5rem;\n border-bottom: var(--md-sys-color-on-surface-variant) 1px dashed;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n #tooltip > .crontab-value {\n text-align: right;\n color: var(--md-sys-color-surface-tint);\n }\n\n #tooltip > .crontab-description {\n text-align: left;\n color: var(--md-sys-color-on-primary-container);\n }\n\n #button-wrapper {\n grid-column: 1 / span 6;\n display: flex;\n flex-wrap: wrap-reverse;\n flex-direction: row-reverse;\n margin: -0.25rem;\n }\n\n button {\n border-radius: var(--button-border-radius);\n margin: 0.25rem;\n }\n button:hover,\n button:active {\n background-color: var(--md-sys-color-on-primary-container);\n }\n `\n\n @property({ type: String }) value?: string\n @property({ type: String }) second?: string\n @property({ type: String }) minute?: string\n @property({ type: String }) hour?: string\n @property({ type: String }) dayOfMonth?: string\n @property({ type: String }) month?: string\n @property({ type: String }) dayOfWeek?: string\n\n @state() tooltip: { value: string; description: string }[] = []\n\n render() {\n return html`\n <form>\n <label for=\"example\">${i18next.t('label.examples')}</label>\n <select\n id=\"example\"\n @change=${(e: Event) => (this.value = (e.currentTarget as HTMLInputElement).value)}\n .value=${this.value || ''}\n >\n <optgroup label=\"String(${i18next.t('label.second by second')})\">\n <option value=\"* * * * * *\">${i18next.t('text.every second')}</option>\n <option value=\"0/2 * * * * *\">${i18next.t('text.every 2 seconds')}</option>\n <option value=\"0/15 * * * * *\">${i18next.t('text.every 15 seconds')}</option>\n <option value=\"0/30 * * * * *\">${i18next.t('text.every 30 seconds')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.minute by minute')})\">\n <option value=\"0 * * * * *\">${i18next.t('text.every minute')}</option>\n <option value=\"0 0/2 * * * *\">${i18next.t('text.every 2 minutes')}</option>\n <option value=\"0 0/15 * * * *\">${i18next.t('text.every 15 minutes')}</option>\n <option value=\"0 0/30 * * * *\">${i18next.t('text.every half hour')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.hourly')})\">\n <option value=\"0 0 * * * *\">${i18next.t('text.every hour')}</option>\n <option value=\"0 0 0/2 * * *\">${i18next.t('text.every 2 hours')}</option>\n <option value=\"0 0 0/12 * * *\">${i18next.t('text.every 12 hours')}</option>\n <option value=\"0 0 10-19 * * *\">${i18next.t('text.every hour during working time')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.daily')})\">\n <option value=\"0 0 0 * * *\">${i18next.t('text.every day')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.weekly')})\">\n <option value=\"0 0 0 * * SUN\">${i18next.t('text.every sunday')}</option>\n <option value=\"0 0 0 * * 0\">${i18next.t('text.every sunday')}(2)</option>\n <option value=\"0 0 0 * * 1-5\">${i18next.t('text.every weekday')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.monthly')})\">\n <option value=\"0 0 0 1 * *\">${i18next.t('text.the first day of every month')}</option>\n <option value=\"0 0 10 21 * *\">${i18next.t('text.10 am on every payday')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.yearly')})\">\n <option value=\"0 0 0 1 1 *\">${i18next.t('text.the first day of every year')}</option>\n <option value=\"0 0 0 25 12 *\">${i18next.t('text.every christmas')}</option>\n </optgroup>\n </select>\n <div id=\"input-wrapper\">\n <div>\n <input\n id=\"second-input\"\n class=\"second\"\n type=\"text\"\n .value=${this.second || ''}\n @input=${(e: Event) => (this.second = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('second')\n }}\n pattern=${createCronRegex('sec')}\n required\n />\n <label for=\"second-input\" class=\"second\">${i18next.t('label.second')}</label>\n </div>\n <div>\n <input\n id=\"minute-input\"\n class=\"minute\"\n type=\"text\"\n .value=${this.minute || ''}\n @input=${(e: Event) => (this.minute = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('minute')\n }}\n pattern=${createCronRegex('min')}\n required\n />\n <label for=\"minute-input\" class=\"minute\">${i18next.t('label.minute')}</label>\n </div>\n <div>\n <input\n id=\"hour-input\"\n class=\"hour\"\n type=\"text\"\n .value=${this.hour || ''}\n @input=${(e: Event) => (this.hour = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('hour')\n }}\n pattern=${createCronRegex('hour')}\n required\n />\n <label for=\"hour-input\" class=\"hour\">${i18next.t('label.hour')}</label>\n </div>\n <div>\n <input\n id=\"day-of-month-input\"\n class=\"day-of-month\"\n type=\"text\"\n .value=${this.dayOfMonth || ''}\n @input=${(e: Event) => (this.dayOfMonth = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('dayOfMonth')\n }}\n pattern=${createCronRegex('day')}\n required\n />\n <label for=\"day-of-month-input\" class=\"day-of-month\">${i18next.t('label.day-of-month')}</label>\n </div>\n <div>\n <input\n id=\"month-input\"\n class=\"month\"\n type=\"text\"\n .value=${this.month || ''}\n @input=${(e: Event) => (this.month = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('month')\n }}\n pattern=${createCronRegex('month')}\n required\n />\n <label for=\"month-input\" class=\"month\">${i18next.t('label.month')}</label>\n </div>\n <div>\n <input\n id=\"day-of-week-input\"\n class=\"day-of-week\"\n type=\"text\"\n .value=${this.dayOfWeek || ''}\n @input=${(e: Event) => (this.dayOfWeek = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('dayOfWeek')\n }}\n pattern=${createCronRegex('dayOfWeek')}\n required\n />\n <label for=\"day-of-week-input\" class=\"day-of-week\">${i18next.t('label.day-of-week')}</label>\n </div>\n </div>\n <div id=\"tooltip\">\n ${this.tooltip.map(\n tip => html`\n <div class=\"crontab-value\">${tip.value}</div>\n <div class=\"crontab-description\">${i18next.t(`text.${tip.description}`)}</div>\n `\n )}\n </div>\n <button\n id=\"clear\"\n @click=${(e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n this.value = ''\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n >\n Clear\n </button>\n </form>\n `\n }\n\n get focusableElements(): HTMLElement[] {\n return Array.from(this.renderRoot.querySelectorAll('select, input, button'))\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n this.renderRoot.addEventListener('change', this.onChange.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n var values = (this.value || '').split(' ')\n\n if (values.length == 1) values = ['*', '*', '*', '*', '*', '*']\n else if (values.length == 5) values = ['0'].concat(values)\n\n this.second = values[0]\n this.minute = values[1]\n this.hour = values[2]\n this.dayOfMonth = values[3]\n this.month = values[4]\n this.dayOfWeek = values[5]\n }\n }\n\n showTooltip(type: 'second' | 'minute' | 'hour' | 'dayOfMonth' | 'month' | 'dayOfWeek') {\n switch (type) {\n case 'second':\n case 'minute':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-59',\n description: 'allowed values'\n }\n ]\n break\n case 'hour':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-23',\n description: 'allowed values'\n }\n ]\n break\n\n case 'dayOfMonth':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '1-31',\n description: 'allowed values'\n }\n ]\n break\n\n case 'month':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '1-12',\n description: 'allowed values'\n },\n {\n value: 'JAN-DEC',\n description: 'alternative single values'\n }\n ]\n break\n\n case 'dayOfWeek':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-6',\n description: 'allowed values'\n },\n {\n value: 'SUN-SAT',\n description: 'alternative single values'\n }\n ]\n break\n\n default:\n this.tooltip = []\n break\n }\n }\n\n onChange() {\n var form = this.renderRoot.querySelector('form') as HTMLFormElement\n var valid = form.checkValidity()\n if (!valid) {\n form.reportValidity()\n return\n }\n\n this.value = `${this.second} ${this.minute} ${this.hour} ${this.dayOfMonth} ${this.month} ${this.dayOfWeek}`\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
@@ -52,8 +52,8 @@ let OxInputDuration = class OxInputDuration extends OxFormField {
52
52
  }
53
53
 
54
54
  input:invalid {
55
- border-bottom: 1px solid var(--status-danger-color);
56
- color: var(--status-danger-color);
55
+ border-bottom: 1px solid var(--md-sys-color-error);
56
+ color: var(--md-sys-color-error);
57
57
  }
58
58
 
59
59
  label {
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-duration.js","sourceRoot":"","sources":["../../src/ox-input-duration.ts"],"names":[],"mappings":"A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AAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAE1C,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,CAAA;QAEvG,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAvG2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAe;AA0E1B;IAAf,KAAK,CAAC,OAAO,CAAC;6CAAwB;AACtB;IAAhB,KAAK,CAAC,QAAQ,CAAC;8CAAyB;AACtB;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA2B;AAC1B;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA2B;AAvIlC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAkK3B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-duration')\nexport class OxInputDuration extends OxFormField {\n static styles = css`\n :host {\n text-align: center;\n padding: 10px;\n --md-filled-icon-button-container-height: var(--form-element-height-medium);\n --md-filled-icon-button-container-shape: var(--md-sys-shape-corner-small);\n }\n\n :host * {\n box-sizing: border-box;\n }\n\n :host *:focus {\n outline: none;\n }\n\n form {\n display: flex;\n flex-direction: row;\n\n align-items: center;\n }\n\n [padding] {\n min-width: 100px;\n }\n\n input {\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n max-width: 70px;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n text-align: right;\n }\n\n input:focus {\n outline: none;\n border-color: var(--md-sys-color-secondary-fixed-dim);\n }\n\n input:invalid {\n border-bottom: 1px solid var(--status-danger-color);\n color: var(--status-danger-color);\n }\n\n label {\n width: 100%;\n margin-right: var(--spacing-medium);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n `\n\n @property({ type: Number }) value?: number\n\n render() {\n var d = Number(this.value || 0)\n\n const days = Math.floor(d / (3600 * 24))\n d -= days * 24 * 3600\n const hours = Math.floor(d / 3600)\n d -= hours * 3600\n const minutes = Math.floor(d / 60)\n const seconds = d - minutes * 60\n\n return html`\n <form @change=${this.onChange.bind(this)}>\n <div padding></div>\n <input id=\"days\" type=\"number\" .value=${String(days || 0)} pattern=\"\\\\d*\" ?disabled=${this.disabled} />\n <label for=\"days\">${i18next.t('label.days')}</label>\n\n <input\n id=\"hours\"\n type=\"number\"\n .value=${String(hours || 0)}\n pattern=\"[01]?\\\\d|2[0-3]\"\n ?disabled=${this.disabled}\n />\n <label for=\"hour\">${i18next.t('label.hours')}</label>\n\n <input\n id=\"minutes\"\n type=\"number\"\n .value=${String(minutes || 0)}\n pattern=\"[0-5]?\\\\d\"\n ?disabled=${this.disabled}\n />\n <label for=\"minute\">${i18next.t('label.minutes')}</label>\n\n <input\n id=\"seconds\"\n type=\"number\"\n .value=${String(seconds || 0)}\n pattern=\"[0-5]?\\\\d\"\n ?disabled=${this.disabled}\n />\n <label for=\"second\">${i18next.t('label.seconds')}</label>\n\n <md-filled-icon-button\n type=\"button\"\n @click=${(e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n\n this.value = 0\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n ?disabled=${this.disabled}\n >\n <md-icon>backspace</md-icon>\n </md-filled-icon-button>\n <div padding></div>\n </form>\n `\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n }\n\n @query('#days') days!: HTMLInputElement\n @query('#hours') hours!: HTMLInputElement\n @query('#minutes') minutes!: HTMLInputElement\n @query('#seconds') seconds!: HTMLInputElement\n\n onChange(e: Event) {\n e.stopPropagation()\n\n var form = this.renderRoot.querySelector('form') as HTMLFormElement\n var valid = form.checkValidity()\n if (!valid) {\n form.reportValidity()\n return\n }\n\n const days = Number(this.days.value)\n const hours = Number(this.hours.value)\n const minutes = Number(this.minutes.value)\n const seconds = Number(this.seconds.value)\n\n this.value = (days || 0) * 24 * 60 * 60 + (hours || 0) * 60 * 60 + (minutes || 0) * 60 + (seconds || 0)\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-duration.js","sourceRoot":"","sources":["../../src/ox-input-duration.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGtC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,WAAW;aACvC,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDlB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,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAvG2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAe;AA0E1B;IAAf,KAAK,CAAC,OAAO,CAAC;6CAAwB;AACtB;IAAhB,KAAK,CAAC,QAAQ,CAAC;8CAAyB;AACtB;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA2B;AAC1B;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA2B;AAvIlC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAkK3B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-duration')\nexport class OxInputDuration extends OxFormField {\n static styles = css`\n :host {\n text-align: center;\n padding: 10px;\n --md-filled-icon-button-container-height: var(--form-element-height-medium);\n --md-filled-icon-button-container-shape: var(--md-sys-shape-corner-small);\n }\n\n :host * {\n box-sizing: border-box;\n }\n\n :host *:focus {\n outline: none;\n }\n\n form {\n display: flex;\n flex-direction: row;\n\n align-items: center;\n }\n\n [padding] {\n min-width: 100px;\n }\n\n input {\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n max-width: 70px;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n text-align: right;\n }\n\n input:focus {\n outline: none;\n border-color: var(--md-sys-color-secondary-fixed-dim);\n }\n\n input:invalid {\n border-bottom: 1px solid var(--md-sys-color-error);\n color: var(--md-sys-color-error);\n }\n\n label {\n width: 100%;\n margin-right: var(--spacing-medium);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n `\n\n @property({ type: Number }) value?: number\n\n render() {\n var d = Number(this.value || 0)\n\n const days = Math.floor(d / (3600 * 24))\n d -= days * 24 * 3600\n const hours = Math.floor(d / 3600)\n d -= hours * 3600\n const minutes = Math.floor(d / 60)\n const seconds = d - minutes * 60\n\n return html`\n <form @change=${this.onChange.bind(this)}>\n <div padding></div>\n <input id=\"days\" type=\"number\" .value=${String(days || 0)} pattern=\"\\\\d*\" ?disabled=${this.disabled} />\n <label for=\"days\">${i18next.t('label.days')}</label>\n\n <input\n id=\"hours\"\n type=\"number\"\n .value=${String(hours || 0)}\n pattern=\"[01]?\\\\d|2[0-3]\"\n ?disabled=${this.disabled}\n />\n <label for=\"hour\">${i18next.t('label.hours')}</label>\n\n <input\n id=\"minutes\"\n type=\"number\"\n .value=${String(minutes || 0)}\n pattern=\"[0-5]?\\\\d\"\n ?disabled=${this.disabled}\n />\n <label for=\"minute\">${i18next.t('label.minutes')}</label>\n\n <input\n id=\"seconds\"\n type=\"number\"\n .value=${String(seconds || 0)}\n pattern=\"[0-5]?\\\\d\"\n ?disabled=${this.disabled}\n />\n <label for=\"second\">${i18next.t('label.seconds')}</label>\n\n <md-filled-icon-button\n type=\"button\"\n @click=${(e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n\n this.value = 0\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n ?disabled=${this.disabled}\n >\n <md-icon>backspace</md-icon>\n </md-filled-icon-button>\n <div padding></div>\n </form>\n `\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n }\n\n @query('#days') days!: HTMLInputElement\n @query('#hours') hours!: HTMLInputElement\n @query('#minutes') minutes!: HTMLInputElement\n @query('#seconds') seconds!: HTMLInputElement\n\n onChange(e: Event) {\n e.stopPropagation()\n\n var form = this.renderRoot.querySelector('form') as HTMLFormElement\n var valid = form.checkValidity()\n if (!valid) {\n form.reportValidity()\n return\n }\n\n const days = Number(this.days.value)\n const hours = Number(this.hours.value)\n const minutes = Number(this.minutes.value)\n const seconds = Number(this.seconds.value)\n\n this.value = (days || 0) * 24 * 60 * 60 + (hours || 0) * 60 * 60 + (minutes || 0) * 60 + (seconds || 0)\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
@@ -85,8 +85,8 @@ let OxInputHashtags = class OxInputHashtags extends OxFormField {
85
85
  }
86
86
 
87
87
  .error {
88
- margin: var(--margin-narrow);
89
- color: var(--status-danger-color);
88
+ margin: var(--spacing-small);
89
+ color: var(--md-sys-color-error);
90
90
  font: var(--input-font);
91
91
  text-align: left;
92
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-hashtags.js","sourceRoot":"","sources":["../../src/ox-input-hashtags.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIzC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,WAAW;IAAzC;;QA+EsB,UAAK,GAAa,EAAE,CAAA;QACnB,gBAAW,GAAW,KAAK,CAAA;IAyFzD,CAAC;aAxKQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAClF,CAAC;;AAzF0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;8CAAqB;AACnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAA4B;AACvC;IAAf,KAAK,CAAC,OAAO,CAAC;8CAAyB;AAE/B;IAAR,KAAK,EAAE;+CAAuB;AAnFpB,eAAe;IAF3B,SAAS,EAAE;IACX,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAyK3B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { when } from 'lit/directives/when.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport { localized, msg } from '@lit/localize'\n\nimport { OxFormField } from './ox-form-field.js'\n\n@localized()\n@customElement('ox-input-hashtags')\nexport class OxInputHashtags extends OxFormField {\n static styles = css`\n #editor {\n display: block;\n box-sizing: border-box;\n --hashtag-padding: 2px 4px;\n --hashtag-background: var(--md-sys-color-container);\n --hashtag-background-hover: var(--md-sys-color-on-container);\n --hashtag-closer-padding: 0 2px 0 4px;\n --hashtag-input-padding: 2px;\n }\n\n .tags {\n display: inline-block;\n }\n\n .tag {\n border-radius: var(--border-radius);\n background-color: var(--hashtag-background);\n padding: var(--hashtag-padding);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n cursor: pointer;\n }\n\n .tag:hover {\n background-color: var(--hashtag-background-hover);\n color: var(--md-sys-color-primary-container) !important;\n }\n\n .closer {\n opacity: 0.3;\n padding: var(--hashtag-closer-padding);\n text-transform: uppercase;\n color: var(--md-sys-color-on-primary-container);\n }\n .tag:hover .closer {\n opacity: 0.9;\n color: var(--md-sys-color-primary-container);\n }\n\n .input {\n display: inline-block;\n color: var(--md-sys-color-on-primary-container);\n }\n\n .input::before {\n display: inline;\n position: relative;\n opacity: 0.5;\n top: -1px;\n content: '#';\n vertical-align: middle;\n }\n\n input {\n vertical-align: middle;\n -webkit-appearance: none;\n -webkit-text-size-adjust: none;\n padding: var(--hashtag-input-padding);\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n outline: none;\n font-weight: bold;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n\n .error {\n margin: var(--margin-narrow);\n color: var(--status-danger-color);\n font: var(--input-font);\n text-align: left;\n }\n `\n\n @property({ type: Array }) value: string[] = []\n @property({ type: String }) placeholder: string = 'tag'\n @query('input') input!: HTMLInputElement\n\n @state() errors?: string | null\n\n render() {\n return html`\n <div id=\"editor\" @click=${this.setHashtags}>\n <div class=\"tags\">\n ${repeat(\n this.value,\n tag => tag,\n (tag, index) => html`\n <span class=\"tag\"\n >#${tag} <span @click=${() => !this.disabled && this.removeHashtag(index)} class=\"closer\">x</span></span\n >\n `\n )}\n </div>\n\n <div class=\"input\">\n <input type=\"text\" @keyup=${this.onInputKeyup} placeholder=\"태그입력\" ?disabled=${this.disabled} />\n </div>\n </div>\n\n ${when(this.errors, () => html`<p class=\"error\">${this.errors}</p>`)}\n `\n }\n\n private onInputKeyup(e: KeyboardEvent) {\n e.stopPropagation()\n\n const tag = this.input.value.trim()\n\n switch (e.key) {\n case 'Enter':\n case 'Spacebar':\n this.addHashtag(tag)\n break\n default:\n this.errors = this.validate(tag)\n }\n }\n\n async setHashtags() {\n this.input.focus()\n }\n\n initErrors() {\n this.errors = null\n }\n\n validate(newtag: string) {\n if (this.value.some(tag => tag === newtag)) {\n return msg('tag duplicated')\n }\n\n const regex = /[~!@#$%^&*()+|<>?:{},.=\"':;/-]/\n if (regex.test(newtag)) {\n return msg('special characters not allowed')\n }\n }\n\n async addHashtag(tag: string) {\n if (!tag) {\n this.initErrors()\n this.input.focus()\n return\n }\n\n this.errors = this.validate(tag)\n if (this.errors) {\n this.input.focus()\n return\n }\n\n this.value = [...this.value, tag]\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n\n this.errors = null\n this.input.value = ''\n this.input.focus()\n }\n\n removeHashtag(idx: number) {\n this.value.splice(idx, 1)\n this.value = [...this.value]\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-hashtags.js","sourceRoot":"","sources":["../../src/ox-input-hashtags.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIzC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,WAAW;IAAzC;;QA+EsB,UAAK,GAAa,EAAE,CAAA;QACnB,gBAAW,GAAW,KAAK,CAAA;IAyFzD,CAAC;aAxKQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4ElB,AA5EY,CA4EZ;IAQD,MAAM;QACJ,OAAO,IAAI,CAAA;gCACiB,IAAI,CAAC,WAAW;;YAEpC,MAAM,CACN,IAAI,CAAC,KAAK,EACV,GAAG,CAAC,EAAE,CAAC,GAAG,EACV,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;;oBAEZ,GAAG,iBAAiB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,C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B,CAAC;GACtB,eAAe,CAyK3B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { when } from 'lit/directives/when.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport { localized, msg } from '@lit/localize'\n\nimport { OxFormField } from './ox-form-field.js'\n\n@localized()\n@customElement('ox-input-hashtags')\nexport class OxInputHashtags extends OxFormField {\n static styles = css`\n #editor {\n display: block;\n box-sizing: border-box;\n --hashtag-padding: 2px 4px;\n --hashtag-background: var(--md-sys-color-container);\n --hashtag-background-hover: var(--md-sys-color-on-container);\n --hashtag-closer-padding: 0 2px 0 4px;\n --hashtag-input-padding: 2px;\n }\n\n .tags {\n display: inline-block;\n }\n\n .tag {\n border-radius: var(--border-radius);\n background-color: var(--hashtag-background);\n padding: var(--hashtag-padding);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n cursor: pointer;\n }\n\n .tag:hover {\n background-color: var(--hashtag-background-hover);\n color: var(--md-sys-color-primary-container) !important;\n }\n\n .closer {\n opacity: 0.3;\n padding: var(--hashtag-closer-padding);\n text-transform: uppercase;\n color: var(--md-sys-color-on-primary-container);\n }\n .tag:hover .closer {\n opacity: 0.9;\n color: var(--md-sys-color-primary-container);\n }\n\n .input {\n display: inline-block;\n color: var(--md-sys-color-on-primary-container);\n }\n\n .input::before {\n display: inline;\n position: relative;\n opacity: 0.5;\n top: -1px;\n content: '#';\n vertical-align: middle;\n }\n\n input {\n vertical-align: middle;\n -webkit-appearance: none;\n -webkit-text-size-adjust: none;\n padding: var(--hashtag-input-padding);\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n outline: none;\n font-weight: bold;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n\n .error {\n margin: var(--spacing-small);\n color: var(--md-sys-color-error);\n font: var(--input-font);\n text-align: left;\n }\n `\n\n @property({ type: Array }) value: string[] = []\n @property({ type: String }) placeholder: string = 'tag'\n @query('input') input!: HTMLInputElement\n\n @state() errors?: string | null\n\n render() {\n return html`\n <div id=\"editor\" @click=${this.setHashtags}>\n <div class=\"tags\">\n ${repeat(\n this.value,\n tag => tag,\n (tag, index) => html`\n <span class=\"tag\"\n >#${tag} <span @click=${() => !this.disabled && this.removeHashtag(index)} class=\"closer\">x</span></span\n >\n `\n )}\n </div>\n\n <div class=\"input\">\n <input type=\"text\" @keyup=${this.onInputKeyup} placeholder=\"태그입력\" ?disabled=${this.disabled} />\n </div>\n </div>\n\n ${when(this.errors, () => html`<p class=\"error\">${this.errors}</p>`)}\n `\n }\n\n private onInputKeyup(e: KeyboardEvent) {\n e.stopPropagation()\n\n const tag = this.input.value.trim()\n\n switch (e.key) {\n case 'Enter':\n case 'Spacebar':\n this.addHashtag(tag)\n break\n default:\n this.errors = this.validate(tag)\n }\n }\n\n async setHashtags() {\n this.input.focus()\n }\n\n initErrors() {\n this.errors = null\n }\n\n validate(newtag: string) {\n if (this.value.some(tag => tag === newtag)) {\n return msg('tag duplicated')\n }\n\n const regex = /[~!@#$%^&*()+|<>?:{},.=\"':;/-]/\n if (regex.test(newtag)) {\n return msg('special characters not allowed')\n }\n }\n\n async addHashtag(tag: string) {\n if (!tag) {\n this.initErrors()\n this.input.focus()\n return\n }\n\n this.errors = this.validate(tag)\n if (this.errors) {\n this.input.focus()\n return\n }\n\n this.value = [...this.value, tag]\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n\n this.errors = null\n this.input.value = ''\n this.input.focus()\n }\n\n removeHashtag(idx: number) {\n this.value.splice(idx, 1)\n this.value = [...this.value]\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -27,7 +27,7 @@ let OxInputKeyValues = class OxInputKeyValues extends OxFormField {
27
27
  display: flex;
28
28
  flex-direction: column;
29
29
  overflow: hidden;
30
- margin-bottom: var(--margin-wide);
30
+ margin-bottom: var(--spacing-large);
31
31
 
32
32
  --md-icon-size: 14px;
33
33
  }
@@ -36,14 +36,14 @@ let OxInputKeyValues = class OxInputKeyValues extends OxFormField {
36
36
  display: flex;
37
37
  flex-flow: row nowrap;
38
38
  gap: var(--spacing-medium);
39
- margin-bottom: var(--margin-narrow);
39
+ margin-bottom: var(--spacing-small);
40
40
  }
41
41
 
42
42
  button {
43
43
  border: var(--button-border);
44
44
  border-radius: var(--border-radius);
45
45
  background-color: var(--button-background-color);
46
- padding: var(--padding-narrow) var(--padding-default);
46
+ padding: var(--spacing-small) var(--padding-default);
47
47
  line-height: 0.8;
48
48
  color: var(--button-color);
49
49
  cursor: pointer;
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-key-values.js","sourceRoot":"","sources":["../../src/ox-input-key-values.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAK7C;;;;;;;;GAQG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QAyDuB,UAAK,GAAc,EAAE,CAAA;QACtB,YAAO,GAAyC,EAAE,CAAA;QAErE,iBAAY,GAAY,KAAK,CAAA;IAwNvC,CAAC;aAnRQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDlB,AAtDY,CAsDZ;IAOD,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACvE,CAAC;IAED,MAAM;QACJ,MAAM,K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AAgB,CAoR5B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\n\nimport { css, html, nothing } from 'lit'\nimport { customElement, property, queryAll } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\ntype KeyValues = { [key: string]: any }\ntype ArrayedKeyValues = { key: string; value: any }\n\n/**\n input component for key-value map\n \n Example:\n \n <ox-input-key-values \n value=${map}\n </ox-input-key-values>\n */\n@customElement('ox-input-key-values')\nexport class OxInputKeyValues extends OxFormField {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n margin-bottom: var(--margin-wide);\n\n --md-icon-size: 14px;\n }\n\n div {\n display: flex;\n flex-flow: row nowrap;\n gap: var(--spacing-medium);\n margin-bottom: var(--margin-narrow);\n }\n\n button {\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n padding: var(--padding-narrow) var(--padding-default);\n line-height: 0.8;\n color: var(--button-color);\n cursor: pointer;\n }\n button + button {\n margin-left: -5px;\n }\n button:focus,\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--button-background-focus-color);\n color: var(--md-sys-color-primary-container);\n }\n\n input {\n flex: 1;\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n padding: var(--spacing-tiny);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n min-width: 50px;\n }\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n button.hidden {\n opacity: 0;\n cursor: default;\n }\n `\n\n @property({ type: Object }) value: KeyValues = {}\n @property({ type: Array }) options: { display: string; value: string }[] = []\n\n private _changingNow: boolean = false\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n render() {\n const value = !this.value || typeof this.value !== 'object' ? {} : this.value\n const options = this.options || []\n\n return html`\n ${this._toArray(value).map(\n item => html`\n <div data-record>\n <input type=\"text\" data-key placeholder=\"key\" .value=${item.key} ?disabled=${this.disabled} />\n <input\n type=\"text\"\n data-value\n placeholder=\"value\"\n .value=${item.value}\n list=\"value-template\"\n ?disabled=${this.disabled}\n />\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._delete(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled}\n >\n <md-icon>remove</md-icon>\n </button>\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._up(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled}\n >\n <md-icon>arrow_upward</md-icon>\n </button>\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._down(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled}\n >\n <md-icon>arrow_downward</md-icon>\n </button>\n </div>\n `\n )}\n ${this.disabled\n ? nothing\n : html`\n <div data-record-new>\n <input type=\"text\" data-key placeholder=\"key\" value=\"\" />\n <input type=\"text\" data-value placeholder=\"value\" value=\"\" list=\"value-template\" />\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._add()} tabindex=\"-1\">\n <md-icon>add</md-icon>\n </button>\n <button class=\"hidden\"><md-icon>add</md-icon></button>\n <button class=\"hidden\"><md-icon>add</md-icon></button>\n </div>\n `}\n\n <datalist id=\"value-template\">\n ${options.map(({ display, value }) => html` <option value=\"${value}\">${display}</option> `)}\n </datalist>\n `\n }\n\n _onChange(e: Event) {\n if (this._changingNow) {\n return\n }\n\n this._changingNow = true\n\n const input = e.target as HTMLInputElement\n\n const record = (e.target as Element).closest('[data-record],[data-record-new]') as HTMLElement\n\n if (record.hasAttribute('data-record')) {\n this._build()\n } else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {\n this._add()\n }\n\n this._changingNow = false\n }\n\n _build(includeNewRecord?: boolean) {\n if (includeNewRecord) {\n var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]') as NodeListOf<HTMLElement>\n } else {\n var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>\n }\n\n var newmap: KeyValues = {}\n\n for (var i = 0; i < records.length; i++) {\n var record = records[i]\n\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const inputs = record.querySelectorAll(\n '[data-value]:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement>\n\n if (!inputs || inputs.length == 0) {\n continue\n }\n\n var input = inputs[inputs.length - 1]\n\n var value = input.value\n\n if (key) {\n newmap[key] = value || ''\n }\n }\n\n this.value = newmap\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n\n /* map아이템들을 template(dom-repeat)용 배열로 변환하는 함수 */\n _toArray(map: KeyValues) {\n var array: ArrayedKeyValues[] = []\n\n for (var key in map) {\n array.push({\n key: key,\n value: map[key]\n })\n }\n\n return array\n }\n\n _add() {\n this._build(true)\n\n const inputs = this.renderRoot.querySelectorAll(\n '[data-record-new] input:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement & { value: any }>\n\n for (var i = 0; i < inputs.length; i++) {\n let input = inputs[i]\n\n if (input.type == 'checkbox') input.checked = false\n else input.value = ''\n }\n\n inputs[0].focus()\n }\n\n _delete(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n\n ;(record!.querySelector('[data-key]') as HTMLInputElement)!.value = ''\n\n this._build()\n }\n\n @queryAll('[data-record]') records!: NodeListOf<HTMLElement>\n\n _up(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record) - 1\n\n if (index < 0) {\n return\n }\n\n const deleted = array.splice(index, 1)\n array.splice(index + 1, 0, ...deleted)\n\n this.value = array.reduce(\n (sum, record) => {\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const value = (record.querySelector('[data-value]') as HTMLInputElement).value\n\n sum[key] = value\n return sum\n },\n {} as { [key: string]: string }\n )\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n\n _down(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record)\n\n if (index > array.length) {\n return\n }\n\n array.splice(index, 1)\n array.splice(index + 1, 0, record)\n\n this.value = array.reduce(\n (sum, record) => {\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const value = (record.querySelector('[data-value]') as HTMLInputElement).value\n\n sum[key] = value\n return sum\n },\n {} as { [key: string]: string }\n )\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-key-values.js","sourceRoot":"","sources":["../../src/ox-input-key-values.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAK7C;;;;;;;;GAQG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QAyDuB,UAAK,GAAc,EAAE,CAAA;QACtB,YAAO,GAAyC,EAAE,CAAA;QAErE,iBAAY,GAAY,KAAK,CAAA;IAwNvC,CAAC;aAnRQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDlB,AAtDY,CAsDZ;IAOD,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACvE,CAAC;IAED,MAAM;QACJ,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC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, html, nothing } from 'lit'\nimport { customElement, property, queryAll } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\ntype KeyValues = { [key: string]: any }\ntype ArrayedKeyValues = { key: string; value: any }\n\n/**\n input component for key-value map\n \n Example:\n \n <ox-input-key-values \n value=${map}\n </ox-input-key-values>\n */\n@customElement('ox-input-key-values')\nexport class OxInputKeyValues extends OxFormField {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n margin-bottom: var(--spacing-large);\n\n --md-icon-size: 14px;\n }\n\n div {\n display: flex;\n flex-flow: row nowrap;\n gap: var(--spacing-medium);\n margin-bottom: var(--spacing-small);\n }\n\n button {\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n padding: var(--spacing-small) var(--padding-default);\n line-height: 0.8;\n color: var(--button-color);\n cursor: pointer;\n }\n button + button {\n margin-left: -5px;\n }\n button:focus,\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--button-background-focus-color);\n color: var(--md-sys-color-primary-container);\n }\n\n input {\n flex: 1;\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n padding: var(--spacing-tiny);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n min-width: 50px;\n }\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n button.hidden {\n opacity: 0;\n cursor: default;\n }\n `\n\n @property({ type: Object }) value: KeyValues = {}\n @property({ type: Array }) options: { display: string; value: string }[] = []\n\n private _changingNow: boolean = false\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n render() {\n const value = !this.value || typeof this.value !== 'object' ? {} : this.value\n const options = this.options || []\n\n return html`\n ${this._toArray(value).map(\n item => html`\n <div data-record>\n <input type=\"text\" data-key placeholder=\"key\" .value=${item.key} ?disabled=${this.disabled} />\n <input\n type=\"text\"\n data-value\n placeholder=\"value\"\n .value=${item.value}\n list=\"value-template\"\n ?disabled=${this.disabled}\n />\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._delete(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled}\n >\n <md-icon>remove</md-icon>\n </button>\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._up(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled}\n >\n <md-icon>arrow_upward</md-icon>\n </button>\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._down(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled}\n >\n <md-icon>arrow_downward</md-icon>\n </button>\n </div>\n `\n )}\n ${this.disabled\n ? nothing\n : html`\n <div data-record-new>\n <input type=\"text\" data-key placeholder=\"key\" value=\"\" />\n <input type=\"text\" data-value placeholder=\"value\" value=\"\" list=\"value-template\" />\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._add()} tabindex=\"-1\">\n <md-icon>add</md-icon>\n </button>\n <button class=\"hidden\"><md-icon>add</md-icon></button>\n <button class=\"hidden\"><md-icon>add</md-icon></button>\n </div>\n `}\n\n <datalist id=\"value-template\">\n ${options.map(({ display, value }) => html` <option value=\"${value}\">${display}</option> `)}\n </datalist>\n `\n }\n\n _onChange(e: Event) {\n if (this._changingNow) {\n return\n }\n\n this._changingNow = true\n\n const input = e.target as HTMLInputElement\n\n const record = (e.target as Element).closest('[data-record],[data-record-new]') as HTMLElement\n\n if (record.hasAttribute('data-record')) {\n this._build()\n } else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {\n this._add()\n }\n\n this._changingNow = false\n }\n\n _build(includeNewRecord?: boolean) {\n if (includeNewRecord) {\n var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]') as NodeListOf<HTMLElement>\n } else {\n var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>\n }\n\n var newmap: KeyValues = {}\n\n for (var i = 0; i < records.length; i++) {\n var record = records[i]\n\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const inputs = record.querySelectorAll(\n '[data-value]:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement>\n\n if (!inputs || inputs.length == 0) {\n continue\n }\n\n var input = inputs[inputs.length - 1]\n\n var value = input.value\n\n if (key) {\n newmap[key] = value || ''\n }\n }\n\n this.value = newmap\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n\n /* map아이템들을 template(dom-repeat)용 배열로 변환하는 함수 */\n _toArray(map: KeyValues) {\n var array: ArrayedKeyValues[] = []\n\n for (var key in map) {\n array.push({\n key: key,\n value: map[key]\n })\n }\n\n return array\n }\n\n _add() {\n this._build(true)\n\n const inputs = this.renderRoot.querySelectorAll(\n '[data-record-new] input:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement & { value: any }>\n\n for (var i = 0; i < inputs.length; i++) {\n let input = inputs[i]\n\n if (input.type == 'checkbox') input.checked = false\n else input.value = ''\n }\n\n inputs[0].focus()\n }\n\n _delete(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n\n ;(record!.querySelector('[data-key]') as HTMLInputElement)!.value = ''\n\n this._build()\n }\n\n @queryAll('[data-record]') records!: NodeListOf<HTMLElement>\n\n _up(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record) - 1\n\n if (index < 0) {\n return\n }\n\n const deleted = array.splice(index, 1)\n array.splice(index + 1, 0, ...deleted)\n\n this.value = array.reduce(\n (sum, record) => {\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const value = (record.querySelector('[data-value]') as HTMLInputElement).value\n\n sum[key] = value\n return sum\n },\n {} as { [key: string]: string }\n )\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n\n _down(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record)\n\n if (index > array.length) {\n return\n }\n\n array.splice(index, 1)\n array.splice(index + 1, 0, record)\n\n this.value = array.reduce(\n (sum, record) => {\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const value = (record.querySelector('[data-value]') as HTMLInputElement).value\n\n sum[key] = value\n return sum\n },\n {} as { [key: string]: string }\n )\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n}\n"]}
@@ -49,7 +49,7 @@ let OxInputMassFraction = class OxInputMassFraction extends OxFormField {
49
49
  display: flex;
50
50
  flex-flow: row nowrap;
51
51
  gap: var(--mass-fraction-gap, 3px);
52
- margin-bottom: var(--margin-narrow);
52
+ margin-bottom: var(--spacing-small);
53
53
  }
54
54
 
55
55
  > [nofraction] {
@@ -62,7 +62,7 @@ let OxInputMassFraction = class OxInputMassFraction extends OxFormField {
62
62
  display: flex;
63
63
  flex-flow: row nowrap;
64
64
  gap: var(--mass-fraction-gap, 3px);
65
- margin: var(--margin-narrow) 0;
65
+ margin: var(--spacing-small) 0;
66
66
  }
67
67
 
68
68
  button {
@@ -1 +1 @@
1
- {"version":3,"file":"ox-input-mass-fraction.js","sourceRoot":"","sources":["../../src/ox-input-mass-fraction.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,gBAAgB,CAAA;AAEvB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK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,CAAsB,CAAC,KAAK,CAAA;YAE9E,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAC7B,OAAO,GAAG,CAAA;QACZ,CAAC,EAAE,EAAkB,CAAC,CAAA;QAEtB,IAAI,CAAC,mBAAmB,EAAE,CAAA;IAC5B,CAAC;IAED,mBAAmB;QACjB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IACtG,CAAC;;AA5R2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAyB;AACN;IAA7C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;uDAA4B;AAE9C;IAA1B,QAAQ,CAAC,eAAe,CAAC;oDAAkC;AAtHjD,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CA+Y/B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\nimport '@operato/popup/ox-popup-list.js'\nimport './ox-select.js'\n\nimport { css, html, nothing } from 'lit'\nimport { customElement, property, queryAll } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { OxFormField } from './ox-form-field'\n\nconst FLUIDS = ['CH4', 'C2H6', 'C3H8', 'C4H10', 'CO2', 'H2O', 'H2S', 'N2', 'N2O', 'NO2', 'O2']\n\ntype ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[]\n ? ElementType\n : never\n\ntype FLUID = ArrayElement<typeof FLUIDS>\n\ntype MassFraction = { [key: FLUID]: number }\ntype ArrayedMassFraction = { key: FLUID; value: number }[]\n\n/**\n input component for mass-fraction map\n \n Example:\n \n <ox-input-mass-fraction \n value=${map}\n </ox-input-mass-fraction>\n */\n@customElement('ox-input-mass-fraction')\nexport class OxInputMassFraction extends OxFormField {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n --md-icon-size: var(--fontsize-default, 14px);\n }\n\n [records] {\n flex: 1;\n\n overflow: overlay;\n\n > div {\n display: flex;\n flex-flow: row nowrap;\n gap: var(--mass-fraction-gap, 3px);\n margin-bottom: var(--margin-narrow);\n }\n\n > [nofraction] {\n display: block;\n text-align: center;\n }\n }\n\n [data-record-new] {\n display: flex;\n flex-flow: row nowrap;\n gap: var(--mass-fraction-gap, 3px);\n margin: var(--margin-narrow) 0;\n }\n\n button {\n display: inherit;\n align-self: center;\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n padding: var(--mass-fraction-button-padding-vertical, 3px) var(--mass-fraction-button-padding-horizontal, 3px);\n color: var(--button-color);\n cursor: pointer;\n\n &:focus,\n &:hover,\n &:active {\n border: var(--button-active-border, 1px solid rgba(0, 0, 0, 0.2));\n background-color: var(--button-background-focus-color);\n color: var(--md-sys-color-primary-container);\n }\n }\n\n input,\n label,\n ox-select {\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n min-width: 50px;\n }\n\n input,\n label {\n padding: var(--spacing-tiny);\n }\n\n label {\n text-align: center;\n text-wrap: nowrap;\n }\n\n ox-select {\n padding: 0;\n }\n\n [data-key] {\n flex: 2;\n }\n\n [data-value] {\n flex: 1;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n\n button.hidden {\n opacity: 0;\n cursor: default;\n }\n\n ox-popup-list {\n max-height: 300px;\n overflow: auto;\n left: 0;\n }\n\n [right-end] {\n margin-left: auto;\n }\n\n [hidden] {\n opacity: 0;\n }\n `\n ]\n\n @property({ type: Object }) defaultValue: MassFraction = {}\n @property({ type: Object }) value: MassFraction = {}\n @property({ type: Boolean, attribute: true }) composable: boolean = false\n\n @queryAll('[data-record]') records!: NodeListOf<HTMLElement>\n\n private options = FLUIDS.map(fluid => html`<div option value=${fluid}>${fluid}</div>`)\n private changingNow: boolean = false\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n render() {\n const value = !this.value || typeof this.value !== 'object' ? {} : this.value\n const arrayed = this._toArray(value)\n\n return html`\n <div records>\n <div data-header>\n <label data-key>성분</label>\n <label data-value>체적비(몰분율)</label>\n <button hidden><md-icon>remove</md-icon></button>\n <button hidden><md-icon>remove</md-icon></button>\n ${this.composable ? html` <button hidden><md-icon>remove</md-icon></button>` : nothing}\n </div>\n ${arrayed.length\n ? arrayed.map(\n (item, idx) => html`\n <div data-record>\n <input type=\"text\" data-key .value=${item.key} disabled />\n <input\n type=\"number\"\n data-value\n placeholder=\"fraction\"\n min=\"0\"\n max=\"1\"\n step=\"0.01\"\n .value=${String(item.value)}\n list=\"value-template\"\n ?disabled=${this.disabled}\n />\n ${this.composable\n ? html`\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._delete(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled}\n >\n <md-icon>remove</md-icon>\n </button>\n `\n : nothing}\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._up(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled || idx === 0}\n >\n <md-icon>arrow_upward</md-icon>\n </button>\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._down(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled || idx === arrayed.length - 1}\n >\n <md-icon>arrow_downward</md-icon>\n </button>\n </div>\n `\n )\n : html`<div nofraction>No Fractions</div>`}\n </div>\n\n ${this.disabled\n ? nothing\n : html`\n <div data-record-new>\n ${this.composable\n ? html`\n <ox-select\n data-key\n placeholder=\"Fluid\"\n .value=${live('')}\n @change=${(e: Event) => {\n e.stopPropagation()\n }}\n >\n <ox-popup-list with-search> ${this.options} </ox-popup-list>\n </ox-select>\n\n <input\n type=\"number\"\n data-value\n placeholder=\"proportion\"\n min=\"0\"\n max=\"1\"\n step=\"0.01\"\n value=\"\"\n list=\"value-template\"\n />\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._add()} tabindex=\"-1\">\n <md-icon>add</md-icon>\n </button>\n `\n : nothing}\n <button\n title=\"fill with the values suggested\"\n @click=${() => {\n this.value = { ...this.defaultValue }\n this.dispatchChangeEvent()\n }}\n right-end\n >\n <md-icon>settings_suggest</md-icon>\n </button>\n <button\n title=\"normalize fraction\"\n @click=${() => {\n this._normalize()\n }}\n >\n <md-icon>repartition</md-icon>\n </button>\n </div>\n `}\n `\n }\n\n _onChange(e: Event) {\n if (this.changingNow) {\n return\n }\n\n this.changingNow = true\n\n const input = e.target as HTMLInputElement\n\n const record = (e.target as Element).closest('[data-record],[data-record-new]') as HTMLElement\n\n if (record.hasAttribute('data-record')) {\n this._build()\n } else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {\n this._add()\n }\n\n this.changingNow = false\n }\n\n _normalize() {\n const fraction: MassFraction = this.value || {}\n const sum = Object.values(fraction).reduce((a, b) => a + b, 0)\n this.value = Object.keys(fraction).reduce((newvalue, key) => {\n newvalue[key] = fraction[key] / sum\n return newvalue\n }, {} as MassFraction)\n\n this.dispatchChangeEvent()\n }\n\n _build(includeNewRecord?: boolean) {\n if (includeNewRecord) {\n var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]') as NodeListOf<HTMLElement>\n } else {\n var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>\n }\n\n var newmap: MassFraction = {}\n\n for (var i = 0; i < records.length; i++) {\n var record = records[i]\n\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const inputs = record.querySelectorAll(\n '[data-value]:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement>\n\n if (!inputs || inputs.length == 0) {\n continue\n }\n\n var input = inputs[inputs.length - 1]\n\n var value = input.value\n\n if (key) {\n newmap[key] = Number(value) || 0\n }\n }\n\n this.value = newmap\n\n this.dispatchChangeEvent()\n }\n\n /* map아이템들을 template(dom-repeat)용 배열로 변환하는 함수 */\n _toArray(map: MassFraction) {\n var array: ArrayedMassFraction = []\n\n for (var key in map) {\n array.push({\n key: key,\n value: map[key]\n })\n }\n\n return array\n }\n\n _add() {\n this._build(true)\n\n const inputs = this.renderRoot.querySelectorAll(\n '[data-record-new] input:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement & { value: any }>\n\n for (var i = 0; i < inputs.length; i++) {\n let input = inputs[i]\n\n if (input.type == 'checkbox') input.checked = false\n else input.value = ''\n }\n\n inputs[0].focus()\n }\n\n _delete(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n\n ;(record!.querySelector('[data-key]') as HTMLInputElement)!.value = ''\n\n this._build()\n }\n\n _up(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record) - 1\n\n if (index < 0) {\n return\n }\n\n const deleted = array.splice(index, 1)\n array.splice(index + 1, 0, ...deleted)\n\n this.value = array.reduce((sum, record) => {\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const value = (record.querySelector('[data-value]') as HTMLInputElement).value\n\n sum[key] = Number(value) || 0\n return sum\n }, {} as MassFraction)\n\n this.dispatchChangeEvent()\n }\n\n _down(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record)\n\n if (index > array.length) {\n return\n }\n\n array.splice(index, 1)\n array.splice(index + 1, 0, record)\n\n this.value = array.reduce((sum, record) => {\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const value = (record.querySelector('[data-value]') as HTMLInputElement).value\n\n sum[key] = Number(value) || 0\n return sum\n }, {} as MassFraction)\n\n this.dispatchChangeEvent()\n }\n\n dispatchChangeEvent() {\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n}\n"]}
1
+ {"version":3,"file":"ox-input-mass-fraction.js","sourceRoot":"","sources":["../../src/ox-input-mass-fraction.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,gBAAgB,CAAA;AAEvB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AAW9F;;;;;;;;GAQG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,WAAW;IAA7C;;QAkHuB,iBAAY,GAAiB,EAAE,CAAA;QAC/B,UAAK,GAAiB,EAAE,CAAA;QACN,eAAU,GAAY,KAAK,CAAA;QAIjE,YAAO,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAA,qBAAqB,KAAK,IAAI,KAAK,QAAQ,CAAC,CAAA;QAC9E,gBAAW,GAAY,KAAK,CAAA;IAsRtC,CAAC;aA9YQ,WAAM,GAAG;QACd,eAAe;QACf,GAAG,CA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EAAE,CAAC;yDAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAyB;AACN;IAA7C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;uDAA4B;AAE9C;IAA1B,QAAQ,CAAC,eAAe,CAAC;oDAAkC;AAtHjD,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CA+Y/B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\nimport '@operato/popup/ox-popup-list.js'\nimport './ox-select.js'\n\nimport { css, html, nothing } from 'lit'\nimport { customElement, property, queryAll } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { OxFormField } from './ox-form-field'\n\nconst FLUIDS = ['CH4', 'C2H6', 'C3H8', 'C4H10', 'CO2', 'H2O', 'H2S', 'N2', 'N2O', 'NO2', 'O2']\n\ntype ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[]\n ? ElementType\n : never\n\ntype FLUID = ArrayElement<typeof FLUIDS>\n\ntype MassFraction = { [key: FLUID]: number }\ntype ArrayedMassFraction = { key: FLUID; value: number }[]\n\n/**\n input component for mass-fraction map\n \n Example:\n \n <ox-input-mass-fraction \n value=${map}\n </ox-input-mass-fraction>\n */\n@customElement('ox-input-mass-fraction')\nexport class OxInputMassFraction extends OxFormField {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n --md-icon-size: var(--fontsize-default, 14px);\n }\n\n [records] {\n flex: 1;\n\n overflow: overlay;\n\n > div {\n display: flex;\n flex-flow: row nowrap;\n gap: var(--mass-fraction-gap, 3px);\n margin-bottom: var(--spacing-small);\n }\n\n > [nofraction] {\n display: block;\n text-align: center;\n }\n }\n\n [data-record-new] {\n display: flex;\n flex-flow: row nowrap;\n gap: var(--mass-fraction-gap, 3px);\n margin: var(--spacing-small) 0;\n }\n\n button {\n display: inherit;\n align-self: center;\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n padding: var(--mass-fraction-button-padding-vertical, 3px) var(--mass-fraction-button-padding-horizontal, 3px);\n color: var(--button-color);\n cursor: pointer;\n\n &:focus,\n &:hover,\n &:active {\n border: var(--button-active-border, 1px solid rgba(0, 0, 0, 0.2));\n background-color: var(--button-background-focus-color);\n color: var(--md-sys-color-primary-container);\n }\n }\n\n input,\n label,\n ox-select {\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n min-width: 50px;\n }\n\n input,\n label {\n padding: var(--spacing-tiny);\n }\n\n label {\n text-align: center;\n text-wrap: nowrap;\n }\n\n ox-select {\n padding: 0;\n }\n\n [data-key] {\n flex: 2;\n }\n\n [data-value] {\n flex: 1;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n\n button.hidden {\n opacity: 0;\n cursor: default;\n }\n\n ox-popup-list {\n max-height: 300px;\n overflow: auto;\n left: 0;\n }\n\n [right-end] {\n margin-left: auto;\n }\n\n [hidden] {\n opacity: 0;\n }\n `\n ]\n\n @property({ type: Object }) defaultValue: MassFraction = {}\n @property({ type: Object }) value: MassFraction = {}\n @property({ type: Boolean, attribute: true }) composable: boolean = false\n\n @queryAll('[data-record]') records!: NodeListOf<HTMLElement>\n\n private options = FLUIDS.map(fluid => html`<div option value=${fluid}>${fluid}</div>`)\n private changingNow: boolean = false\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n render() {\n const value = !this.value || typeof this.value !== 'object' ? {} : this.value\n const arrayed = this._toArray(value)\n\n return html`\n <div records>\n <div data-header>\n <label data-key>성분</label>\n <label data-value>체적비(몰분율)</label>\n <button hidden><md-icon>remove</md-icon></button>\n <button hidden><md-icon>remove</md-icon></button>\n ${this.composable ? html` <button hidden><md-icon>remove</md-icon></button>` : nothing}\n </div>\n ${arrayed.length\n ? arrayed.map(\n (item, idx) => html`\n <div data-record>\n <input type=\"text\" data-key .value=${item.key} disabled />\n <input\n type=\"number\"\n data-value\n placeholder=\"fraction\"\n min=\"0\"\n max=\"1\"\n step=\"0.01\"\n .value=${String(item.value)}\n list=\"value-template\"\n ?disabled=${this.disabled}\n />\n ${this.composable\n ? html`\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._delete(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled}\n >\n <md-icon>remove</md-icon>\n </button>\n `\n : nothing}\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._up(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled || idx === 0}\n >\n <md-icon>arrow_upward</md-icon>\n </button>\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._down(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled || idx === arrayed.length - 1}\n >\n <md-icon>arrow_downward</md-icon>\n </button>\n </div>\n `\n )\n : html`<div nofraction>No Fractions</div>`}\n </div>\n\n ${this.disabled\n ? nothing\n : html`\n <div data-record-new>\n ${this.composable\n ? html`\n <ox-select\n data-key\n placeholder=\"Fluid\"\n .value=${live('')}\n @change=${(e: Event) => {\n e.stopPropagation()\n }}\n >\n <ox-popup-list with-search> ${this.options} </ox-popup-list>\n </ox-select>\n\n <input\n type=\"number\"\n data-value\n placeholder=\"proportion\"\n min=\"0\"\n max=\"1\"\n step=\"0.01\"\n value=\"\"\n list=\"value-template\"\n />\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._add()} tabindex=\"-1\">\n <md-icon>add</md-icon>\n </button>\n `\n : nothing}\n <button\n title=\"fill with the values suggested\"\n @click=${() => {\n this.value = { ...this.defaultValue }\n this.dispatchChangeEvent()\n }}\n right-end\n >\n <md-icon>settings_suggest</md-icon>\n </button>\n <button\n title=\"normalize fraction\"\n @click=${() => {\n this._normalize()\n }}\n >\n <md-icon>repartition</md-icon>\n </button>\n </div>\n `}\n `\n }\n\n _onChange(e: Event) {\n if (this.changingNow) {\n return\n }\n\n this.changingNow = true\n\n const input = e.target as HTMLInputElement\n\n const record = (e.target as Element).closest('[data-record],[data-record-new]') as HTMLElement\n\n if (record.hasAttribute('data-record')) {\n this._build()\n } else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {\n this._add()\n }\n\n this.changingNow = false\n }\n\n _normalize() {\n const fraction: MassFraction = this.value || {}\n const sum = Object.values(fraction).reduce((a, b) => a + b, 0)\n this.value = Object.keys(fraction).reduce((newvalue, key) => {\n newvalue[key] = fraction[key] / sum\n return newvalue\n }, {} as MassFraction)\n\n this.dispatchChangeEvent()\n }\n\n _build(includeNewRecord?: boolean) {\n if (includeNewRecord) {\n var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]') as NodeListOf<HTMLElement>\n } else {\n var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>\n }\n\n var newmap: MassFraction = {}\n\n for (var i = 0; i < records.length; i++) {\n var record = records[i]\n\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const inputs = record.querySelectorAll(\n '[data-value]:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement>\n\n if (!inputs || inputs.length == 0) {\n continue\n }\n\n var input = inputs[inputs.length - 1]\n\n var value = input.value\n\n if (key) {\n newmap[key] = Number(value) || 0\n }\n }\n\n this.value = newmap\n\n this.dispatchChangeEvent()\n }\n\n /* map아이템들을 template(dom-repeat)용 배열로 변환하는 함수 */\n _toArray(map: MassFraction) {\n var array: ArrayedMassFraction = []\n\n for (var key in map) {\n array.push({\n key: key,\n value: map[key]\n })\n }\n\n return array\n }\n\n _add() {\n this._build(true)\n\n const inputs = this.renderRoot.querySelectorAll(\n '[data-record-new] input:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement & { value: any }>\n\n for (var i = 0; i < inputs.length; i++) {\n let input = inputs[i]\n\n if (input.type == 'checkbox') input.checked = false\n else input.value = ''\n }\n\n inputs[0].focus()\n }\n\n _delete(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n\n ;(record!.querySelector('[data-key]') as HTMLInputElement)!.value = ''\n\n this._build()\n }\n\n _up(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record) - 1\n\n if (index < 0) {\n return\n }\n\n const deleted = array.splice(index, 1)\n array.splice(index + 1, 0, ...deleted)\n\n this.value = array.reduce((sum, record) => {\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const value = (record.querySelector('[data-value]') as HTMLInputElement).value\n\n sum[key] = Number(value) || 0\n return sum\n }, {} as MassFraction)\n\n this.dispatchChangeEvent()\n }\n\n _down(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record)\n\n if (index > array.length) {\n return\n }\n\n array.splice(index, 1)\n array.splice(index + 1, 0, record)\n\n this.value = array.reduce((sum, record) => {\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const value = (record.querySelector('[data-value]') as HTMLInputElement).value\n\n sum[key] = Number(value) || 0\n return sum\n }, {} as MassFraction)\n\n this.dispatchChangeEvent()\n }\n\n dispatchChangeEvent() {\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n}\n"]}
@@ -17,7 +17,7 @@ let OxInputOptions = class OxInputOptions extends OxFormField {
17
17
  display: flex;
18
18
  flex-direction: column;
19
19
  overflow: hidden;
20
- margin-bottom: var(--margin-wide);
20
+ margin-bottom: var(--spacing-large);
21
21
 
22
22
  --md-icon-size: var(--fontsize-default, 14px);
23
23
  }
@@ -26,7 +26,7 @@ let OxInputOptions = class OxInputOptions extends OxFormField {
26
26
  display: flex;
27
27
  flex-flow: row nowrap;
28
28
  gap: var(--spacing-medium);
29
- margin-bottom: var(--margin-narrow);
29
+ margin-bottom: var(--spacing-small);
30
30
  }
31
31
 
32
32
  button {