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,50 +1,50 @@
1
- Simple example
2
-
3
- ```vue
4
- <template>
5
- <div class="pad-l5">
6
- <p>
7
- <input
8
- class="input input-small"
9
- type="number"
10
- v-model.number="model.h"
11
- v-bind="inputs.h"
12
- style="width:4rem"
13
- />
14
- <span>:</span>
15
- <input
16
- class="input input-small"
17
- type="number"
18
- v-model.number="model.m"
19
- v-bind="inputs.m"
20
- style="width:4rem"
21
- />
22
- </p>
23
- <p>value: {{ model }}</p>
24
- <time-picker v-model="model" v-bind="props" style="width:10rem"></time-picker>
25
- </div>
26
- </template>
27
- <script>
28
- export default {
29
- data() {
30
- return {
31
- model: { h: 18, m: 50 },
32
- props: {
33
- step: { h: 1, m: 10 },
34
- min: { h: 10, m: 0 },
35
- max: { h: 18, m: 59 },
36
- },
37
- };
38
- },
39
- computed: {
40
- inputs() {
41
- const { step, min, max } = this.props;
42
- return {
43
- h: { step: step.h, min: min.h, max: max.h },
44
- m: { step: step.m, min: min.m, max: max.m },
45
- };
46
- },
47
- },
48
- };
49
- </script>
50
- ```
1
+ Simple example
2
+
3
+ ```vue
4
+ <template>
5
+ <div class="pad-l5">
6
+ <p>
7
+ <input
8
+ class="input input-small"
9
+ type="number"
10
+ v-model.number="model.h"
11
+ v-bind="inputs.h"
12
+ style="width:4rem"
13
+ />
14
+ <span>:</span>
15
+ <input
16
+ class="input input-small"
17
+ type="number"
18
+ v-model.number="model.m"
19
+ v-bind="inputs.m"
20
+ style="width:4rem"
21
+ />
22
+ </p>
23
+ <p>value: {{ model }}</p>
24
+ <time-picker v-model="model" v-bind="props" style="width:10rem"></time-picker>
25
+ </div>
26
+ </template>
27
+ <script>
28
+ export default {
29
+ data() {
30
+ return {
31
+ model: { h: 18, m: 50 },
32
+ props: {
33
+ step: { h: 1, m: 10 },
34
+ min: { h: 10, m: 0 },
35
+ max: { h: 18, m: 59 },
36
+ },
37
+ };
38
+ },
39
+ computed: {
40
+ inputs() {
41
+ const { step, min, max } = this.props;
42
+ return {
43
+ h: { step: step.h, min: min.h, max: max.h },
44
+ m: { step: step.m, min: min.m, max: max.m },
45
+ };
46
+ },
47
+ },
48
+ };
49
+ </script>
50
+ ```
@@ -1,252 +1,252 @@
1
- <template>
2
- <div class="ui-time-picker panel">
3
- <ui-datalist
4
- class="ui-time-picker-datalist shadow-none radius-none w-6-12"
5
- v-bind="{ cursorIndex: hCursorIndex, options: hourOptions }"
6
- >
7
- <template #header>
8
- <!--
9
- @slot Hour label slot
10
- -->
11
- <slot name="hour-label">
12
- <div class="bg-primary color-white text-small text-center pad-3">Час</div>
13
- </slot>
14
- </template>
15
- <template #option="{ option, index, cursorIndex }">
16
- <!--
17
- @slot Hour option slot
18
- @binding {Boolean} isActive whether the option is active (selected)
19
- @binding {Number} option the hour option
20
- @binding {Number} index options' index
21
- @binding {Number} cursorIndex the current cursor index position
22
- @binding {Function} select function which selects the option function(option)
23
- -->
24
- <slot
25
- name="hour-option"
26
- v-bind="{
27
- isActive: option === h,
28
- option,
29
- index,
30
- cursorIndex,
31
- select: selectHour,
32
- }"
33
- >
34
- <li :class="{ active: option === h }" @click="selectHour(option)">
35
- <div class="text-small text-center text-truncate">{{ lz(option) }}</div>
36
- </li>
37
- </slot>
38
- </template>
39
- </ui-datalist>
40
- <ui-datalist
41
- class="ui-time-picker-datalist shadow-none radius-none w-6-12"
42
- v-bind="{ cursorIndex: mCursorIndex, options: minOptions }"
43
- >
44
- <template #header>
45
- <!--
46
- @slot Minute label slot
47
- -->
48
- <slot name="min-label">
49
- <div class="bg-primary color-white text-small text-center pad-3">Мин</div>
50
- </slot>
51
- </template>
52
- <template #option="{ option, index, cursorIndex }">
53
- <!--
54
- @slot Minute option slot
55
- @binding {Boolean} isActive whether the option is active (selected)
56
- @binding {Number} option the min option
57
- @binding {Number} index options' index
58
- @binding {Number} cursorIndex the current cursor index position
59
- @binding {Function} select function which selects the option function(option)
60
- -->
61
- <slot
62
- name="min-option"
63
- v-bind="{
64
- isActive: option === m,
65
- option,
66
- index,
67
- cursorIndex,
68
- select: selectMin,
69
- }"
70
- >
71
- <li :class="{ active: option === m }" @click="selectMin(option)">
72
- <div class="text-small text-center text-truncate">{{ lz(option) }}</div>
73
- </li>
74
- </slot>
75
- </template>
76
- </ui-datalist>
77
- </div>
78
- </template>
79
- <style lang="less" scoped>
80
- .ui-time-picker {
81
- --ui-time-picker-item-size: calc(1rem + var(--font-size-smaller) * 1.5);
82
- --ui-time-picker-datalist-min-items: 3;
83
- --ui-time-picker-datalist-max-items: 5;
84
- display: inline-flex;
85
- overflow: hidden;
86
- &-datalist {
87
- z-index: auto;
88
- min-width: 3em;
89
- ::v-deep > ul {
90
- min-height: calc(
91
- var(--ui-time-picker-item-size) * var(--ui-time-picker-datalist-min-items)
92
- );
93
- max-height: calc(
94
- var(--ui-time-picker-item-size) * var(--ui-time-picker-datalist-max-items)
95
- );
96
- scroll-behavior: smooth;
97
- }
98
- }
99
- }
100
- </style>
101
- <script>
102
- import UiDatalist from './Datalist.vue';
103
-
104
- export default {
105
- components: { UiDatalist },
106
- props: {
107
- /**
108
- * @model Object { h:Number, m:Number } where h stands for 'hour'; m stands for 'minute'
109
- */
110
- value: {
111
- type: Object,
112
- default() {
113
- return null;
114
- },
115
- },
116
- /**
117
- * Hour/minute step size Object (works similar to how input step attribute works)
118
- * { h:Number, m:Number } where h stands for 'hour step'; m stands for 'minute step'
119
- */
120
- step: {
121
- type: Object,
122
- default() {
123
- return { h: 1, m: 15 };
124
- },
125
- },
126
- /**
127
- * Hour/minute min limit Object (works similar to how input min attribute works)
128
- * { h:Number, m:Number } where h stands for 'min hour'; m stands for 'min minute'
129
- */
130
- min: {
131
- type: Object,
132
- default() {
133
- return { h: 0, m: 0 };
134
- },
135
- },
136
- /**
137
- * Hour/minute max limit Object (works similar to how input max attribute works)
138
- * { h:Number, m:Number } where h stands for 'max hour'; m stands for 'max minute'
139
- */
140
- max: {
141
- type: Object,
142
- default() {
143
- return { h: 23, m: 59 };
144
- },
145
- },
146
- /**
147
- * Hour/minute cursor indexes Object
148
- * { h:Number, m:Number } where h stands for 'hour cursor index'; m stands for 'minute cursor index'
149
- */
150
- cursorIndex: {
151
- type: Object,
152
- default() {
153
- return { h: 0, m: 0 };
154
- },
155
- },
156
- },
157
- data() {
158
- return {
159
- h: -1,
160
- m: -1,
161
- hCursorIndex: -1,
162
- mCursorIndex: -1,
163
- lz(n) {
164
- return n < 10 ? `0${n}` : `${n}`;
165
- },
166
- };
167
- },
168
- watch: {
169
- value: {
170
- handler(val) {
171
- this.$nextTick(() => {
172
- this.m = val ? val.m : -1;
173
- this.h = val ? val.h : -1;
174
- });
175
- },
176
- immediate: true,
177
- deep: true,
178
- },
179
- h: {
180
- handler(val) {
181
- this.hCursorIndex = this.hourOptions.findIndex(i => i === val);
182
- },
183
- immediate: true,
184
- },
185
- m: {
186
- handler(val) {
187
- this.mCursorIndex = this.minOptions.findIndex(i => i === val);
188
- },
189
- immediate: true,
190
- },
191
- cursorIndex: {
192
- handler({ h, m }) {
193
- h = parseInt(h);
194
- m = parseInt(m);
195
- this.hCursorIndex = isNaN(h) ? this.hCursorIndex : h;
196
- this.mCursorIndex = isNaN(m) ? this.mCursorIndex : m;
197
- },
198
- immediate: true,
199
- deep: true,
200
- },
201
- },
202
- computed: {
203
- hourOptions() {
204
- let a = [];
205
- let n = Math.floor(24 / this.step.h);
206
- for (let i = 0; i < n; ++i) {
207
- let v = i * this.step.h;
208
- if (v >= this.min.h && v <= this.max.h) {
209
- a.push(v);
210
- }
211
- }
212
- return a;
213
- },
214
- minOptions() {
215
- let a = [];
216
- let n = Math.floor(60 / this.step.m);
217
- for (let i = 0; i < n; ++i) {
218
- let v = i * this.step.m;
219
- if (v >= this.min.m && v <= this.max.m) {
220
- a.push(v);
221
- }
222
- }
223
- return a;
224
- },
225
- },
226
- methods: {
227
- selectHour(val) {
228
- this.h = val;
229
- this._triggerValueChange();
230
- },
231
- selectMin(val) {
232
- this.m = val;
233
- this._triggerValueChange();
234
- },
235
- _triggerValueChange() {
236
- if (this.h >= 0 && this.m >= 0) {
237
- let obj = { h: this.h, m: this.m };
238
- /**
239
- * Input event
240
- * @property {Object} option
241
- */
242
- this.$emit('input', obj);
243
- /**
244
- * Change event
245
- * @property {Object} option
246
- */
247
- this.$emit('change', obj);
248
- }
249
- },
250
- },
251
- };
252
- </script>
1
+ <template>
2
+ <div class="ui-time-picker panel">
3
+ <ui-datalist
4
+ class="ui-time-picker-datalist shadow-none radius-none w-6-12"
5
+ v-bind="{ cursorIndex: hCursorIndex, options: hourOptions }"
6
+ >
7
+ <template #header>
8
+ <!--
9
+ @slot Hour label slot
10
+ -->
11
+ <slot name="hour-label">
12
+ <div class="bg-primary color-white text-small text-center pad-3">Час</div>
13
+ </slot>
14
+ </template>
15
+ <template #option="{ option, index, cursorIndex }">
16
+ <!--
17
+ @slot Hour option slot
18
+ @binding {Boolean} isActive whether the option is active (selected)
19
+ @binding {Number} option the hour option
20
+ @binding {Number} index options' index
21
+ @binding {Number} cursorIndex the current cursor index position
22
+ @binding {Function} select function which selects the option function(option)
23
+ -->
24
+ <slot
25
+ name="hour-option"
26
+ v-bind="{
27
+ isActive: option === h,
28
+ option,
29
+ index,
30
+ cursorIndex,
31
+ select: selectHour,
32
+ }"
33
+ >
34
+ <li :class="{ active: option === h }" @click="selectHour(option)">
35
+ <div class="text-small text-center text-truncate">{{ lz(option) }}</div>
36
+ </li>
37
+ </slot>
38
+ </template>
39
+ </ui-datalist>
40
+ <ui-datalist
41
+ class="ui-time-picker-datalist shadow-none radius-none w-6-12"
42
+ v-bind="{ cursorIndex: mCursorIndex, options: minOptions }"
43
+ >
44
+ <template #header>
45
+ <!--
46
+ @slot Minute label slot
47
+ -->
48
+ <slot name="min-label">
49
+ <div class="bg-primary color-white text-small text-center pad-3">Мин</div>
50
+ </slot>
51
+ </template>
52
+ <template #option="{ option, index, cursorIndex }">
53
+ <!--
54
+ @slot Minute option slot
55
+ @binding {Boolean} isActive whether the option is active (selected)
56
+ @binding {Number} option the min option
57
+ @binding {Number} index options' index
58
+ @binding {Number} cursorIndex the current cursor index position
59
+ @binding {Function} select function which selects the option function(option)
60
+ -->
61
+ <slot
62
+ name="min-option"
63
+ v-bind="{
64
+ isActive: option === m,
65
+ option,
66
+ index,
67
+ cursorIndex,
68
+ select: selectMin,
69
+ }"
70
+ >
71
+ <li :class="{ active: option === m }" @click="selectMin(option)">
72
+ <div class="text-small text-center text-truncate">{{ lz(option) }}</div>
73
+ </li>
74
+ </slot>
75
+ </template>
76
+ </ui-datalist>
77
+ </div>
78
+ </template>
79
+ <style lang="less" scoped>
80
+ .ui-time-picker {
81
+ --ui-time-picker-item-size: calc(1rem + var(--font-size-smaller) * 1.5);
82
+ --ui-time-picker-datalist-min-items: 3;
83
+ --ui-time-picker-datalist-max-items: 5;
84
+ display: inline-flex;
85
+ overflow: hidden;
86
+ &-datalist {
87
+ z-index: auto;
88
+ min-width: 3em;
89
+ ::v-deep > ul {
90
+ min-height: calc(
91
+ var(--ui-time-picker-item-size) * var(--ui-time-picker-datalist-min-items)
92
+ );
93
+ max-height: calc(
94
+ var(--ui-time-picker-item-size) * var(--ui-time-picker-datalist-max-items)
95
+ );
96
+ scroll-behavior: smooth;
97
+ }
98
+ }
99
+ }
100
+ </style>
101
+ <script>
102
+ import UiDatalist from './Datalist.vue';
103
+
104
+ export default {
105
+ components: { UiDatalist },
106
+ props: {
107
+ /**
108
+ * @model Object { h:Number, m:Number } where h stands for 'hour'; m stands for 'minute'
109
+ */
110
+ value: {
111
+ type: Object,
112
+ default() {
113
+ return null;
114
+ },
115
+ },
116
+ /**
117
+ * Hour/minute step size Object (works similar to how input step attribute works)
118
+ * { h:Number, m:Number } where h stands for 'hour step'; m stands for 'minute step'
119
+ */
120
+ step: {
121
+ type: Object,
122
+ default() {
123
+ return { h: 1, m: 15 };
124
+ },
125
+ },
126
+ /**
127
+ * Hour/minute min limit Object (works similar to how input min attribute works)
128
+ * { h:Number, m:Number } where h stands for 'min hour'; m stands for 'min minute'
129
+ */
130
+ min: {
131
+ type: Object,
132
+ default() {
133
+ return { h: 0, m: 0 };
134
+ },
135
+ },
136
+ /**
137
+ * Hour/minute max limit Object (works similar to how input max attribute works)
138
+ * { h:Number, m:Number } where h stands for 'max hour'; m stands for 'max minute'
139
+ */
140
+ max: {
141
+ type: Object,
142
+ default() {
143
+ return { h: 23, m: 59 };
144
+ },
145
+ },
146
+ /**
147
+ * Hour/minute cursor indexes Object
148
+ * { h:Number, m:Number } where h stands for 'hour cursor index'; m stands for 'minute cursor index'
149
+ */
150
+ cursorIndex: {
151
+ type: Object,
152
+ default() {
153
+ return { h: 0, m: 0 };
154
+ },
155
+ },
156
+ },
157
+ data() {
158
+ return {
159
+ h: -1,
160
+ m: -1,
161
+ hCursorIndex: -1,
162
+ mCursorIndex: -1,
163
+ lz(n) {
164
+ return n < 10 ? `0${n}` : `${n}`;
165
+ },
166
+ };
167
+ },
168
+ watch: {
169
+ value: {
170
+ handler(val) {
171
+ this.$nextTick(() => {
172
+ this.m = val ? val.m : -1;
173
+ this.h = val ? val.h : -1;
174
+ });
175
+ },
176
+ immediate: true,
177
+ deep: true,
178
+ },
179
+ h: {
180
+ handler(val) {
181
+ this.hCursorIndex = this.hourOptions.findIndex(i => i === val);
182
+ },
183
+ immediate: true,
184
+ },
185
+ m: {
186
+ handler(val) {
187
+ this.mCursorIndex = this.minOptions.findIndex(i => i === val);
188
+ },
189
+ immediate: true,
190
+ },
191
+ cursorIndex: {
192
+ handler({ h, m }) {
193
+ h = parseInt(h);
194
+ m = parseInt(m);
195
+ this.hCursorIndex = isNaN(h) ? this.hCursorIndex : h;
196
+ this.mCursorIndex = isNaN(m) ? this.mCursorIndex : m;
197
+ },
198
+ immediate: true,
199
+ deep: true,
200
+ },
201
+ },
202
+ computed: {
203
+ hourOptions() {
204
+ let a = [];
205
+ let n = Math.floor(24 / this.step.h);
206
+ for (let i = 0; i < n; ++i) {
207
+ let v = i * this.step.h;
208
+ if (v >= this.min.h && v <= this.max.h) {
209
+ a.push(v);
210
+ }
211
+ }
212
+ return a;
213
+ },
214
+ minOptions() {
215
+ let a = [];
216
+ let n = Math.floor(60 / this.step.m);
217
+ for (let i = 0; i < n; ++i) {
218
+ let v = i * this.step.m;
219
+ if (v >= this.min.m && v <= this.max.m) {
220
+ a.push(v);
221
+ }
222
+ }
223
+ return a;
224
+ },
225
+ },
226
+ methods: {
227
+ selectHour(val) {
228
+ this.h = val;
229
+ this._triggerValueChange();
230
+ },
231
+ selectMin(val) {
232
+ this.m = val;
233
+ this._triggerValueChange();
234
+ },
235
+ _triggerValueChange() {
236
+ if (this.h >= 0 && this.m >= 0) {
237
+ let obj = { h: this.h, m: this.m };
238
+ /**
239
+ * Input event
240
+ * @property {Object} option
241
+ */
242
+ this.$emit('input', obj);
243
+ /**
244
+ * Change event
245
+ * @property {Object} option
246
+ */
247
+ this.$emit('change', obj);
248
+ }
249
+ },
250
+ },
251
+ };
252
+ </script>