goodteditor-ui 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.eslintrc.js +7 -7
  2. package/.prettierrc +14 -14
  3. package/README.md +35 -35
  4. package/babel.config.js +5 -5
  5. package/dist/js.png +0 -0
  6. package/index.js +51 -51
  7. package/jsconfig.json +13 -13
  8. package/package.json +57 -57
  9. package/src/App.vue +36 -36
  10. package/src/components/ui/Avatar.md +68 -68
  11. package/src/components/ui/Avatar.vue +177 -177
  12. package/src/components/ui/Badge.md +20 -20
  13. package/src/components/ui/Badge.vue +75 -75
  14. package/src/components/ui/Collapse.md +90 -90
  15. package/src/components/ui/Collapse.vue +86 -86
  16. package/src/components/ui/ColorPicker/Alpha.vue +114 -114
  17. package/src/components/ui/ColorPicker/Colors.vue +117 -117
  18. package/src/components/ui/ColorPicker/Hue.vue +113 -113
  19. package/src/components/ui/ColorPicker/Preview.vue +55 -55
  20. package/src/components/ui/ColorPicker/Saturation.vue +123 -123
  21. package/src/components/ui/ColorPicker/mixin.js +105 -105
  22. package/src/components/ui/ColorPicker.md +17 -17
  23. package/src/components/ui/ColorPicker.vue +314 -314
  24. package/src/components/ui/Datalist.md +41 -41
  25. package/src/components/ui/Datalist.vue +157 -157
  26. package/src/components/ui/DatePicker.md +168 -168
  27. package/src/components/ui/DatePicker.vue +527 -527
  28. package/src/components/ui/FileSelector.md +105 -105
  29. package/src/components/ui/FileSelector.vue +82 -82
  30. package/src/components/ui/Grid.md +130 -130
  31. package/src/components/ui/Grid.vue +92 -92
  32. package/src/components/ui/Image.md +59 -59
  33. package/src/components/ui/Image.vue +57 -57
  34. package/src/components/ui/InputAutocomplete.md +115 -115
  35. package/src/components/ui/InputAutocomplete.vue +341 -341
  36. package/src/components/ui/InputColorPicker.md +51 -51
  37. package/src/components/ui/InputColorPicker.vue +151 -151
  38. package/src/components/ui/InputDatePicker.md +121 -121
  39. package/src/components/ui/InputDatePicker.vue +310 -310
  40. package/src/components/ui/InputTags.md +51 -51
  41. package/src/components/ui/InputTags.vue +184 -184
  42. package/src/components/ui/InputTimePicker.md +25 -25
  43. package/src/components/ui/InputTimePicker.vue +253 -253
  44. package/src/components/ui/InputUnits.md +20 -20
  45. package/src/components/ui/InputUnits.vue +257 -257
  46. package/src/components/ui/Lazy.md +37 -37
  47. package/src/components/ui/Lazy.vue +92 -92
  48. package/src/components/ui/Pagination.md +74 -74
  49. package/src/components/ui/Pagination.vue +138 -138
  50. package/src/components/ui/Paginator.md +34 -34
  51. package/src/components/ui/Paginator.vue +83 -83
  52. package/src/components/ui/Popover.md +34 -34
  53. package/src/components/ui/Popover.vue +258 -209
  54. package/src/components/ui/Popup.md +59 -59
  55. package/src/components/ui/Popup.vue +150 -150
  56. package/src/components/ui/ResponsiveContainer.md +58 -58
  57. package/src/components/ui/ResponsiveContainer.vue +99 -99
  58. package/src/components/ui/Select.md +187 -187
  59. package/src/components/ui/Select.vue +420 -420
  60. package/src/components/ui/TimePicker.md +50 -50
  61. package/src/components/ui/TimePicker.vue +252 -252
  62. package/src/components/ui/Tooltip.md +114 -52
  63. package/src/components/ui/Tooltip.vue +113 -113
  64. package/src/components/ui/utils/FormComponent.js +107 -107
  65. package/src/components/ui/utils/Helpers.js +84 -61
  66. package/src/components/ui/utils/WithPopover.js +99 -81
  67. package/src/main.js +8 -8
  68. package/styleguide.config.js +37 -37
  69. package/vue.config.js +8 -8
  70. package/.idea/codeStyles/Project.xml +0 -51
  71. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  72. package/.idea/goodt-ui.iml +0 -12
  73. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  74. package/.idea/modules.xml +0 -8
  75. package/.idea/vcs.xml +0 -6
@@ -1,257 +1,257 @@
1
- <template>
2
- <div
3
- class="ui-input-units form-elem"
4
- :class="cssClass"
5
- :data-popover="popoverTargetId"
6
- @focus="onRootFocus"
7
- tabindex="0"
8
- >
9
- <!--
10
- @slot Custom input slot
11
- @binding {String} id input id attribute value
12
- @binding {String} value input value
13
- @binding {Object} inputBinds input props (use v-bind)
14
- @binding {Object} inputEvents input events (use v-on)
15
- -->
16
- <slot name="input" v-bind="{ id: inputId, value: model.value, inputBinds, inputEvents }">
17
- <input
18
- :id="inputId"
19
- class="ui-input-units-input text-right w-100"
20
- v-model.number="model.value"
21
- v-bind="inputBinds"
22
- v-on="inputEvents"
23
- />
24
- </slot>
25
- <div>
26
- <span class="ui-input-units-link link" @click.stop="togglePopover">
27
- {{ model.unit }}
28
- </span>
29
- </div>
30
- <ui-popover :show.sync="popoverShow" v-bind="popoverOptions">
31
- <ui-datalist
32
- class="pull-left w-100"
33
- ref="datalist"
34
- v-bind="{ options: units, size }"
35
- :cursorIndex.sync="dataListCursorIndex"
36
- @select-option="onUnitChange"
37
- >
38
- <template #header>
39
- <!--
40
- @slot Dropdown header content
41
- -->
42
- <slot name="dropdown-header"></slot>
43
- </template>
44
- <template
45
- #option="{
46
- option,
47
- index,
48
- cursorIndex,
49
- setCursorIndex,
50
- }"
51
- >
52
- <!--
53
- @slot Dropdown option
54
- @binding {String} option option
55
- @binding {Number} index option index
56
- @binding {String} selectedOption current selected option
57
- @binding {Number} cursorIndex current dropdown selection index
58
- @binding {Function} selectOption function that select's the option
59
- @binding {Function} setCursorIndex function that sets the cursor index
60
- -->
61
- <slot
62
- name="option"
63
- v-bind="{
64
- option,
65
- index,
66
- selectedOption: model.unit,
67
- cursorIndex,
68
- select: selectUnit,
69
- setCursorIndex,
70
- }"
71
- ></slot>
72
- </template>
73
- <template #footer>
74
- <slot name="dropdown-footer"></slot>
75
- </template>
76
- </ui-datalist>
77
- </ui-popover>
78
- </div>
79
- </template>
80
- <style lang="less" scoped>
81
- .ui-input-units {
82
- display: inline-flex;
83
- align-items: center;
84
- &-input {
85
- line-height: 1.5;
86
- border: none;
87
- outline: none;
88
- appearance: none;
89
- margin: 0;
90
- padding: 0;
91
- color: inherit;
92
- background: transparent;
93
- outline: none;
94
- -moz-appearance: textfield;
95
- &::-webkit-outer-spin-button,
96
- &::-webkit-inner-spin-button {
97
- -webkit-appearance: none;
98
- margin: 0;
99
- }
100
- &:invalid {
101
- box-shadow: none;
102
- }
103
- }
104
- &-link {
105
- margin-left: 0.125em;
106
- }
107
- &.valid,
108
- &.invalid,
109
- &.disabled {
110
- .ui-input-units-link {
111
- color: inherit;
112
- border-color: inherit;
113
- }
114
- }
115
- }
116
- </style>
117
- <script>
118
- import FormComponent from './utils/FormComponent';
119
- import WithPopover from './utils/WithPopover';
120
- import UiDatalist from './Datalist.vue';
121
- import UiPopover from './Popover.vue';
122
- import { Key, Position } from './utils/Helpers';
123
-
124
- const withUnitRegExp = /^(-?[\d.]*)(\D+)$/i;
125
-
126
- export default {
127
- mixins: [FormComponent, WithPopover],
128
- components: { UiDatalist, UiPopover },
129
- props: {
130
- /**
131
- * Unit options String[]
132
- */
133
- units: {
134
- type: Array,
135
- default() {
136
- return [];
137
- },
138
- },
139
- position: {
140
- type: String,
141
- default: `${Position.BOTTOM}-${Position.END}`,
142
- },
143
- },
144
- data() {
145
- return {
146
- model: {
147
- value: '',
148
- unit: '',
149
- },
150
- inputBinds: {
151
- placeholder: this.placeholder,
152
- readonly: this.readonly,
153
- type: 'number',
154
- step: 'none',
155
- },
156
- inputEvents: {
157
- change: this.onInputChange,
158
- input: this.onInputInput,
159
- focus: this.onInputFocus,
160
- blur: this.onInputBlur,
161
- keydown: this.onInputKeydown,
162
- },
163
- dataListCursorIndex: -1,
164
- };
165
- },
166
- computed: {
167
- valuePrivate() {
168
- const { value, unit } = this.model;
169
- return `${value}${unit}`;
170
- },
171
- isModelValid() {
172
- const { value, unit } = this.model;
173
- return !isNaN(value) && value !== '' && !!unit;
174
- },
175
- },
176
- watch: {
177
- value: {
178
- handler(v) {
179
- const a = String(v).match(withUnitRegExp);
180
- const { units } = this;
181
- let unit = units.length ? units[0] : '';
182
- let value = '';
183
-
184
- if (!a) {
185
- value = v;
186
- } else {
187
- const [_, n, u] = a;
188
- if (units.includes(u)) {
189
- value = n;
190
- unit = u;
191
- }
192
- }
193
- this.dataListCursorIndex = units.indexOf(unit);
194
- this.model = { value, unit };
195
- },
196
- immediate: true,
197
- },
198
- },
199
- methods: {
200
- emitInput() {
201
- const value = this.isModelValid ? this.valuePrivate : '';
202
- /**
203
- * Change event
204
- * @property {String} value
205
- */
206
- this.$emit('input', value);
207
- },
208
- emitChange() {
209
- const value = this.isModelValid ? this.valuePrivate : '';
210
- /**
211
- * Input event
212
- * @property {String} value
213
- */
214
- this.$emit('change', value);
215
- },
216
- selectUnit(unit) {
217
- this.popoverShow = false;
218
- if (this.model.unit == unit) {
219
- return;
220
- }
221
- this.model.unit = unit;
222
- this.emitInput();
223
- this.emitChange();
224
- },
225
- onRootFocus(e) {
226
- let input = this.getInputRef();
227
- input && input.focus();
228
- },
229
- onInputBlur(e) {
230
- this.rootHasFocus = false;
231
- },
232
- onInputFocus(e) {
233
- this.rootHasFocus = true;
234
- /**
235
- * Input focus event
236
- * @property {Node} node
237
- */
238
- this.$emit('focus', e.target);
239
- },
240
- onInputChange(e) {
241
- this.emitChange();
242
- },
243
- onInputInput(e) {
244
- this.emitInput();
245
- },
246
- onInputKeydown(e) {
247
- const { key } = e;
248
- if (key === Key.ESC) {
249
- this.popoverShow = false;
250
- }
251
- },
252
- onUnitChange({ option }) {
253
- this.selectUnit(option);
254
- },
255
- },
256
- };
257
- </script>
1
+ <template>
2
+ <div
3
+ class="ui-input-units form-elem"
4
+ :class="cssClass"
5
+ :data-popover="popoverTargetId"
6
+ @focus="onRootFocus"
7
+ tabindex="0"
8
+ >
9
+ <!--
10
+ @slot Custom input slot
11
+ @binding {String} id input id attribute value
12
+ @binding {String} value input value
13
+ @binding {Object} inputBinds input props (use v-bind)
14
+ @binding {Object} inputEvents input events (use v-on)
15
+ -->
16
+ <slot name="input" v-bind="{ id: inputId, value: model.value, inputBinds, inputEvents }">
17
+ <input
18
+ :id="inputId"
19
+ class="ui-input-units-input text-right w-100"
20
+ v-model.number="model.value"
21
+ v-bind="inputBinds"
22
+ v-on="inputEvents"
23
+ />
24
+ </slot>
25
+ <div>
26
+ <span class="ui-input-units-link link" @click.stop="togglePopover">
27
+ {{ model.unit }}
28
+ </span>
29
+ </div>
30
+ <ui-popover :show.sync="popoverShow" v-bind="popoverOptions">
31
+ <ui-datalist
32
+ class="pull-left w-100"
33
+ ref="datalist"
34
+ v-bind="{ options: units, size }"
35
+ :cursorIndex.sync="dataListCursorIndex"
36
+ @select-option="onUnitChange"
37
+ >
38
+ <template #header>
39
+ <!--
40
+ @slot Dropdown header content
41
+ -->
42
+ <slot name="dropdown-header"></slot>
43
+ </template>
44
+ <template
45
+ #option="{
46
+ option,
47
+ index,
48
+ cursorIndex,
49
+ setCursorIndex,
50
+ }"
51
+ >
52
+ <!--
53
+ @slot Dropdown option
54
+ @binding {String} option option
55
+ @binding {Number} index option index
56
+ @binding {String} selectedOption current selected option
57
+ @binding {Number} cursorIndex current dropdown selection index
58
+ @binding {Function} selectOption function that select's the option
59
+ @binding {Function} setCursorIndex function that sets the cursor index
60
+ -->
61
+ <slot
62
+ name="option"
63
+ v-bind="{
64
+ option,
65
+ index,
66
+ selectedOption: model.unit,
67
+ cursorIndex,
68
+ select: selectUnit,
69
+ setCursorIndex,
70
+ }"
71
+ ></slot>
72
+ </template>
73
+ <template #footer>
74
+ <slot name="dropdown-footer"></slot>
75
+ </template>
76
+ </ui-datalist>
77
+ </ui-popover>
78
+ </div>
79
+ </template>
80
+ <style lang="less" scoped>
81
+ .ui-input-units {
82
+ display: inline-flex;
83
+ align-items: center;
84
+ &-input {
85
+ line-height: 1.5;
86
+ border: none;
87
+ outline: none;
88
+ appearance: none;
89
+ margin: 0;
90
+ padding: 0;
91
+ color: inherit;
92
+ background: transparent;
93
+ outline: none;
94
+ -moz-appearance: textfield;
95
+ &::-webkit-outer-spin-button,
96
+ &::-webkit-inner-spin-button {
97
+ -webkit-appearance: none;
98
+ margin: 0;
99
+ }
100
+ &:invalid {
101
+ box-shadow: none;
102
+ }
103
+ }
104
+ &-link {
105
+ margin-left: 0.125em;
106
+ }
107
+ &.valid,
108
+ &.invalid,
109
+ &.disabled {
110
+ .ui-input-units-link {
111
+ color: inherit;
112
+ border-color: inherit;
113
+ }
114
+ }
115
+ }
116
+ </style>
117
+ <script>
118
+ import FormComponent from './utils/FormComponent';
119
+ import WithPopover from './utils/WithPopover';
120
+ import UiDatalist from './Datalist.vue';
121
+ import UiPopover from './Popover.vue';
122
+ import { Key, Position } from './utils/Helpers';
123
+
124
+ const withUnitRegExp = /^(-?[\d.]*)(\D+)$/i;
125
+
126
+ export default {
127
+ mixins: [FormComponent, WithPopover],
128
+ components: { UiDatalist, UiPopover },
129
+ props: {
130
+ /**
131
+ * Unit options String[]
132
+ */
133
+ units: {
134
+ type: Array,
135
+ default() {
136
+ return [];
137
+ },
138
+ },
139
+ position: {
140
+ type: String,
141
+ default: `${Position.BOTTOM}-${Position.END}`,
142
+ },
143
+ },
144
+ data() {
145
+ return {
146
+ model: {
147
+ value: '',
148
+ unit: '',
149
+ },
150
+ inputBinds: {
151
+ placeholder: this.placeholder,
152
+ readonly: this.readonly,
153
+ type: 'number',
154
+ step: 'none',
155
+ },
156
+ inputEvents: {
157
+ change: this.onInputChange,
158
+ input: this.onInputInput,
159
+ focus: this.onInputFocus,
160
+ blur: this.onInputBlur,
161
+ keydown: this.onInputKeydown,
162
+ },
163
+ dataListCursorIndex: -1,
164
+ };
165
+ },
166
+ computed: {
167
+ valuePrivate() {
168
+ const { value, unit } = this.model;
169
+ return `${value}${unit}`;
170
+ },
171
+ isModelValid() {
172
+ const { value, unit } = this.model;
173
+ return !isNaN(value) && value !== '' && !!unit;
174
+ },
175
+ },
176
+ watch: {
177
+ value: {
178
+ handler(v) {
179
+ const a = String(v).match(withUnitRegExp);
180
+ const { units } = this;
181
+ let unit = units.length ? units[0] : '';
182
+ let value = '';
183
+
184
+ if (!a) {
185
+ value = v;
186
+ } else {
187
+ const [_, n, u] = a;
188
+ if (units.includes(u)) {
189
+ value = n;
190
+ unit = u;
191
+ }
192
+ }
193
+ this.dataListCursorIndex = units.indexOf(unit);
194
+ this.model = { value, unit };
195
+ },
196
+ immediate: true,
197
+ },
198
+ },
199
+ methods: {
200
+ emitInput() {
201
+ const value = this.isModelValid ? this.valuePrivate : '';
202
+ /**
203
+ * Change event
204
+ * @property {String} value
205
+ */
206
+ this.$emit('input', value);
207
+ },
208
+ emitChange() {
209
+ const value = this.isModelValid ? this.valuePrivate : '';
210
+ /**
211
+ * Input event
212
+ * @property {String} value
213
+ */
214
+ this.$emit('change', value);
215
+ },
216
+ selectUnit(unit) {
217
+ this.popoverShow = false;
218
+ if (this.model.unit == unit) {
219
+ return;
220
+ }
221
+ this.model.unit = unit;
222
+ this.emitInput();
223
+ this.emitChange();
224
+ },
225
+ onRootFocus(e) {
226
+ let input = this.getInputRef();
227
+ input && input.focus();
228
+ },
229
+ onInputBlur(e) {
230
+ this.rootHasFocus = false;
231
+ },
232
+ onInputFocus(e) {
233
+ this.rootHasFocus = true;
234
+ /**
235
+ * Input focus event
236
+ * @property {Node} node
237
+ */
238
+ this.$emit('focus', e.target);
239
+ },
240
+ onInputChange(e) {
241
+ this.emitChange();
242
+ },
243
+ onInputInput(e) {
244
+ this.emitInput();
245
+ },
246
+ onInputKeydown(e) {
247
+ const { key } = e;
248
+ if (key === Key.ESC) {
249
+ this.popoverShow = false;
250
+ }
251
+ },
252
+ onUnitChange({ option }) {
253
+ this.selectUnit(option);
254
+ },
255
+ },
256
+ };
257
+ </script>
@@ -1,37 +1,37 @@
1
- ```vue
2
- <template>
3
- <div class="pad-l5">
4
- <p>Lazy list: {{ numItems }} items (see devtools)</p>
5
- <div id="lazy-container" class="tile">
6
- <ui-lazy v-bind="props" v-for="i in numItems" :key="`lazy` + i">
7
- <test-component>lazy #{{ i }}</test-component>
8
- </ui-lazy>
9
- </div>
10
- </div>
11
- </template>
12
- <script>
13
- import UiLazy from './Lazy.vue';
14
-
15
- const TestComponent = {
16
- template: `<div class="pad-h-l1 pad-v-3"><slot></slot></div>`,
17
- };
18
- export default {
19
- components: { UiLazy, TestComponent },
20
- data() {
21
- return {
22
- props: {
23
- root: '#lazy-container',
24
- minHeight: '2rem',
25
- },
26
- numItems: 1000,
27
- };
28
- },
29
- };
30
- </script>
31
- <style scoped>
32
- #lazy-container {
33
- overflow: auto;
34
- max-height: 10rem;
35
- }
36
- </style>
37
- ```
1
+ ```vue
2
+ <template>
3
+ <div class="pad-l5">
4
+ <p>Lazy list: {{ numItems }} items (see devtools)</p>
5
+ <div id="lazy-container" class="tile">
6
+ <ui-lazy v-bind="props" v-for="i in numItems" :key="`lazy` + i">
7
+ <test-component>lazy #{{ i }}</test-component>
8
+ </ui-lazy>
9
+ </div>
10
+ </div>
11
+ </template>
12
+ <script>
13
+ import UiLazy from './Lazy.vue';
14
+
15
+ const TestComponent = {
16
+ template: `<div class="pad-h-l1 pad-v-3"><slot></slot></div>`,
17
+ };
18
+ export default {
19
+ components: { UiLazy, TestComponent },
20
+ data() {
21
+ return {
22
+ props: {
23
+ root: '#lazy-container',
24
+ minHeight: '2rem',
25
+ },
26
+ numItems: 1000,
27
+ };
28
+ },
29
+ };
30
+ </script>
31
+ <style scoped>
32
+ #lazy-container {
33
+ overflow: auto;
34
+ max-height: 10rem;
35
+ }
36
+ </style>
37
+ ```