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,310 +1,310 @@
1
- <template>
2
- <div
3
- class="ui-input-date-picker form-elem"
4
- :class="cssClass"
5
- @focus="onRootFocus"
6
- tabindex="0"
7
- :data-popover="popoverTargetId"
8
- >
9
- <div class="ui-input-date-picker-wrapper d-flex flex-v-center w-100">
10
- <div style="flex: 1 0 0">
11
- <!--
12
- @slot Custom input slot
13
- @binding {String} id input id attribute value
14
- @binding {String} value input value
15
- @binding {String} valueLabel input value label
16
- @binding {Object} inputBinds input props (use v-bind)
17
- @binding {Object} inputEvents input events (use v-on)
18
- -->
19
- <slot
20
- name="input"
21
- v-bind="{ id: inputId, value, valueLabel, inputBinds, inputEvents }"
22
- >
23
- <input
24
- :id="inputId"
25
- class="ui-input-date-picker-input w-100"
26
- type="text"
27
- :value="valueLabel"
28
- v-bind="inputBinds"
29
- v-on="inputEvents"
30
- />
31
- </slot>
32
- </div>
33
- <!--
34
- @slot Custom clear icon slot
35
- @binding {Function} clear function that clears the value
36
- -->
37
- <slot name="clear" v-bind="{ clear }" v-if="value && value.length && allowClear">
38
- <div class="icon cursor-pointer w-auto h-auto mar-left-2" @click="clear">
39
- <i class="mdi mdi-close"></i>
40
- </div>
41
- </slot>
42
- <!--
43
- @slot Icon slot
44
- @binding {Function} toggle function that toggles the datepicker
45
- -->
46
- <slot name="icon" v-bind="{ toggle: togglePopover }">
47
- <div class="icon cursor-pointer w-auto h-auto mar-left-2" @click="togglePopover">
48
- <i class="mdi mdi-calendar"></i>
49
- </div>
50
- </slot>
51
- </div>
52
- <ui-popover :show.sync="popoverShow" v-bind="popoverOptions">
53
- <date-picker
54
- class="ui-input-date-picker-dp pull-left"
55
- @change="onDpChange"
56
- @set-date="onDpSetDate"
57
- v-bind="{ value: date, ...datepicker }"
58
- >
59
- <template #header="scope">
60
- <!--
61
- @slot @see [DatePicker.slots.header](#datepicker)
62
- -->
63
- <slot name="dp-header" v-bind="scope"></slot>
64
- </template>
65
- <template #cell-day="scope">
66
- <!--
67
- @slot @see [DatePicker.slots.cell-day](#datepicker)
68
- -->
69
- <slot name="dp-cell-day" v-bind="scope"></slot>
70
- </template>
71
- <template #cell-date="scope">
72
- <!--
73
- @slot @see [DatePicker.slots.cell-date](#datepicker)
74
- -->
75
- <slot name="dp-cell-date" v-bind="scope"></slot>
76
- </template>
77
- <template #left>
78
- <!--
79
- @slot @see [DatePicker.slots.left](#datepicker)
80
- -->
81
- <slot name="dp-left"></slot>
82
- </template>
83
- <template #right>
84
- <!--
85
- @slot @see [DatePicker.slots.right](#datepicker)
86
- -->
87
- <slot name="dp-right"></slot>
88
- </template>
89
- </date-picker>
90
- </ui-popover>
91
- </div>
92
- </template>
93
- <style lang="less" scoped>
94
- .ui-input-date-picker {
95
- display: inline-flex;
96
- &-input {
97
- border: none;
98
- margin: 0;
99
- padding: 0;
100
- line-height: 1.5;
101
- color: inherit;
102
- background: transparent;
103
- outline: none;
104
- }
105
- }
106
- </style>
107
- <script>
108
- import DatePicker from './DatePicker.vue';
109
- import UiPopover from './Popover.vue';
110
- import FormComponent from './utils/FormComponent';
111
- import WithPopover from './utils/WithPopover';
112
- import { isDateValid } from './utils/Helpers';
113
-
114
- let lz = n => (n < 10 ? `0${n}` : `${n}`);
115
- export default {
116
- mixins: [FormComponent, WithPopover],
117
- components: { DatePicker, UiPopover },
118
- props: {
119
- /**
120
- * @model
121
- */
122
- value: {
123
- type: [String, Array],
124
- default: '',
125
- },
126
- /**
127
- * Whether the input is editable
128
- */
129
- editable: {
130
- type: Boolean,
131
- default: true,
132
- },
133
- /**
134
- * Allow clearing the date
135
- */
136
- allowClear: {
137
- type: Boolean,
138
- default: true,
139
- },
140
- /**
141
- * Datepicker options
142
- * @see [DatePicker.props](#datepicker)
143
- */
144
- datepicker: {
145
- type: Object,
146
- default() {
147
- return {};
148
- },
149
- },
150
- /**
151
- * Date range delimiter (only if datepicker.range = true)
152
- */
153
- delimiter: {
154
- type: String,
155
- default: ' – ',
156
- },
157
- /**
158
- * Function which parses date String -> Date
159
- * function(str:String):Date
160
- */
161
- toDate: {
162
- type: Function,
163
- default(str) {
164
- if (!str) {
165
- return null;
166
- }
167
- let mt = str.match(/^(\d{1,}).(\d{1,}).(\d{1,})$/);
168
- if (mt) {
169
- mt.shift();
170
- let [d, m, y] = mt.map(v => parseInt(v));
171
- if (d > 0 && m > 0 && y >= 0) {
172
- return new Date(y, m - 1, d);
173
- }
174
- }
175
- return null;
176
- },
177
- },
178
- /**
179
- * Function which formats date Date -> String
180
- * function(date:Date):String
181
- */
182
- toValue: {
183
- type: Function,
184
- default(date) {
185
- if (!isDateValid(date)) {
186
- return '';
187
- }
188
- return `${lz(date.getDate())}.${lz(date.getMonth() + 1)}.${lz(date.getFullYear())}`;
189
- },
190
- },
191
- },
192
- data() {
193
- return {
194
- date: null,
195
- inputBinds: {
196
- placeholder: this.placeholder,
197
- readonly: this.readonly || !this.editable,
198
- },
199
- inputEvents: {
200
- change: this.onInputChange,
201
- focus: this.onInputFocus,
202
- blur: this.onInputBlur,
203
- },
204
- };
205
- },
206
- watch: {
207
- value: {
208
- handler(val) {
209
- if (this.isRange) {
210
- let d = Array.isArray(val) ? val.map(this.toDate) : [];
211
- let [s, e] = d;
212
- if (s && e && isDateValid(s) && isDateValid(e) && s < e) {
213
- this.date = d;
214
- } else {
215
- this.date = [];
216
- }
217
- } else {
218
- let d = this.toDate(val);
219
- this.date = isDateValid(d) ? d : null;
220
- }
221
- },
222
- immediate: true,
223
- },
224
- isRange(val) {
225
- /**
226
- * Input event
227
- * @property {String} date
228
- */
229
- this.$emit('input', val ? [] : '');
230
- },
231
- placeholder(placeholder) {
232
- this.inputBinds = { ...this.inputBinds, placeholder };
233
- },
234
- },
235
- computed: {
236
- isRange() {
237
- return !!this.datepicker.range;
238
- },
239
- valueLabel() {
240
- return Array.isArray(this.value) ? this.value.join(this.delimiter) : this.value;
241
- },
242
- },
243
- methods: {
244
- clear() {
245
- /**
246
- * Input event
247
- * @property {String} date
248
- */
249
- this.$emit('input', this.isRange ? [] : '');
250
- /**
251
- * Clear event
252
- */
253
- this.$emit('clear');
254
- },
255
- onRootFocus(e) {
256
- let input = this.getInputRef();
257
- input && input.focus();
258
- },
259
- onInputChange(e) {
260
- let val = e.target.value;
261
- let data = null;
262
-
263
- if (this.isRange) {
264
- let d = val.split(this.delimiter).map(this.toDate);
265
- let [s, e] = d;
266
- data = isDateValid(s) && isDateValid(e) && s < e ? d.map(this.toValue) : [];
267
- } else {
268
- let d = this.toDate(val);
269
- data = isDateValid(d) ? this.toValue(d) : '';
270
- }
271
- /**
272
- * Input event
273
- * @property {String|Array} value
274
- */
275
- this.$emit('input', data);
276
- /**
277
- * Change event
278
- * @property {String|Array} value
279
- */
280
- this.$emit('change', data);
281
- },
282
- onInputFocus(e) {
283
- this.rootHasFocus = true;
284
- },
285
- onInputBlur(e) {
286
- this.rootHasFocus = false;
287
- },
288
- onDpChange(date) {
289
- let data = Array.isArray(date) ? date.map(this.toValue) : this.toValue(date);
290
- /**
291
- * Input event
292
- * @property {String} date
293
- */
294
- this.$emit('input', data);
295
- /**
296
- * Change event
297
- * @property {String} date
298
- */
299
- this.$emit('change', data);
300
- },
301
- onDpSetDate(date) {
302
- /**
303
- * Set date event
304
- * @property {Date} date
305
- */
306
- this.$emit('set-date', date);
307
- },
308
- },
309
- };
310
- </script>
1
+ <template>
2
+ <div
3
+ class="ui-input-date-picker form-elem"
4
+ :class="cssClass"
5
+ @focus="onRootFocus"
6
+ tabindex="0"
7
+ :data-popover="popoverTargetId"
8
+ >
9
+ <div class="ui-input-date-picker-wrapper d-flex flex-v-center w-100">
10
+ <div style="flex: 1 0 0">
11
+ <!--
12
+ @slot Custom input slot
13
+ @binding {String} id input id attribute value
14
+ @binding {String} value input value
15
+ @binding {String} valueLabel input value label
16
+ @binding {Object} inputBinds input props (use v-bind)
17
+ @binding {Object} inputEvents input events (use v-on)
18
+ -->
19
+ <slot
20
+ name="input"
21
+ v-bind="{ id: inputId, value, valueLabel, inputBinds, inputEvents }"
22
+ >
23
+ <input
24
+ :id="inputId"
25
+ class="ui-input-date-picker-input w-100"
26
+ type="text"
27
+ :value="valueLabel"
28
+ v-bind="inputBinds"
29
+ v-on="inputEvents"
30
+ />
31
+ </slot>
32
+ </div>
33
+ <!--
34
+ @slot Custom clear icon slot
35
+ @binding {Function} clear function that clears the value
36
+ -->
37
+ <slot name="clear" v-bind="{ clear }" v-if="value && value.length && allowClear">
38
+ <div class="icon cursor-pointer w-auto h-auto mar-left-2" @click="clear">
39
+ <i class="mdi mdi-close"></i>
40
+ </div>
41
+ </slot>
42
+ <!--
43
+ @slot Icon slot
44
+ @binding {Function} toggle function that toggles the datepicker
45
+ -->
46
+ <slot name="icon" v-bind="{ toggle: togglePopover }">
47
+ <div class="icon cursor-pointer w-auto h-auto mar-left-2" @click="togglePopover">
48
+ <i class="mdi mdi-calendar"></i>
49
+ </div>
50
+ </slot>
51
+ </div>
52
+ <ui-popover :show.sync="popoverShow" v-bind="popoverOptions">
53
+ <date-picker
54
+ class="ui-input-date-picker-dp pull-left"
55
+ @change="onDpChange"
56
+ @set-date="onDpSetDate"
57
+ v-bind="{ value: date, ...datepicker }"
58
+ >
59
+ <template #header="scope">
60
+ <!--
61
+ @slot @see [DatePicker.slots.header](#datepicker)
62
+ -->
63
+ <slot name="dp-header" v-bind="scope"></slot>
64
+ </template>
65
+ <template #cell-day="scope">
66
+ <!--
67
+ @slot @see [DatePicker.slots.cell-day](#datepicker)
68
+ -->
69
+ <slot name="dp-cell-day" v-bind="scope"></slot>
70
+ </template>
71
+ <template #cell-date="scope">
72
+ <!--
73
+ @slot @see [DatePicker.slots.cell-date](#datepicker)
74
+ -->
75
+ <slot name="dp-cell-date" v-bind="scope"></slot>
76
+ </template>
77
+ <template #left>
78
+ <!--
79
+ @slot @see [DatePicker.slots.left](#datepicker)
80
+ -->
81
+ <slot name="dp-left"></slot>
82
+ </template>
83
+ <template #right>
84
+ <!--
85
+ @slot @see [DatePicker.slots.right](#datepicker)
86
+ -->
87
+ <slot name="dp-right"></slot>
88
+ </template>
89
+ </date-picker>
90
+ </ui-popover>
91
+ </div>
92
+ </template>
93
+ <style lang="less" scoped>
94
+ .ui-input-date-picker {
95
+ display: inline-flex;
96
+ &-input {
97
+ border: none;
98
+ margin: 0;
99
+ padding: 0;
100
+ line-height: 1.5;
101
+ color: inherit;
102
+ background: transparent;
103
+ outline: none;
104
+ }
105
+ }
106
+ </style>
107
+ <script>
108
+ import DatePicker from './DatePicker.vue';
109
+ import UiPopover from './Popover.vue';
110
+ import FormComponent from './utils/FormComponent';
111
+ import WithPopover from './utils/WithPopover';
112
+ import { isDateValid } from './utils/Helpers';
113
+
114
+ let lz = n => (n < 10 ? `0${n}` : `${n}`);
115
+ export default {
116
+ mixins: [FormComponent, WithPopover],
117
+ components: { DatePicker, UiPopover },
118
+ props: {
119
+ /**
120
+ * @model
121
+ */
122
+ value: {
123
+ type: [String, Array],
124
+ default: '',
125
+ },
126
+ /**
127
+ * Whether the input is editable
128
+ */
129
+ editable: {
130
+ type: Boolean,
131
+ default: true,
132
+ },
133
+ /**
134
+ * Allow clearing the date
135
+ */
136
+ allowClear: {
137
+ type: Boolean,
138
+ default: true,
139
+ },
140
+ /**
141
+ * Datepicker options
142
+ * @see [DatePicker.props](#datepicker)
143
+ */
144
+ datepicker: {
145
+ type: Object,
146
+ default() {
147
+ return {};
148
+ },
149
+ },
150
+ /**
151
+ * Date range delimiter (only if datepicker.range = true)
152
+ */
153
+ delimiter: {
154
+ type: String,
155
+ default: ' – ',
156
+ },
157
+ /**
158
+ * Function which parses date String -> Date
159
+ * function(str:String):Date
160
+ */
161
+ toDate: {
162
+ type: Function,
163
+ default(str) {
164
+ if (!str) {
165
+ return null;
166
+ }
167
+ let mt = str.match(/^(\d{1,}).(\d{1,}).(\d{1,})$/);
168
+ if (mt) {
169
+ mt.shift();
170
+ let [d, m, y] = mt.map(v => parseInt(v));
171
+ if (d > 0 && m > 0 && y >= 0) {
172
+ return new Date(y, m - 1, d);
173
+ }
174
+ }
175
+ return null;
176
+ },
177
+ },
178
+ /**
179
+ * Function which formats date Date -> String
180
+ * function(date:Date):String
181
+ */
182
+ toValue: {
183
+ type: Function,
184
+ default(date) {
185
+ if (!isDateValid(date)) {
186
+ return '';
187
+ }
188
+ return `${lz(date.getDate())}.${lz(date.getMonth() + 1)}.${lz(date.getFullYear())}`;
189
+ },
190
+ },
191
+ },
192
+ data() {
193
+ return {
194
+ date: null,
195
+ inputBinds: {
196
+ placeholder: this.placeholder,
197
+ readonly: this.readonly || !this.editable,
198
+ },
199
+ inputEvents: {
200
+ change: this.onInputChange,
201
+ focus: this.onInputFocus,
202
+ blur: this.onInputBlur,
203
+ },
204
+ };
205
+ },
206
+ watch: {
207
+ value: {
208
+ handler(val) {
209
+ if (this.isRange) {
210
+ let d = Array.isArray(val) ? val.map(this.toDate) : [];
211
+ let [s, e] = d;
212
+ if (s && e && isDateValid(s) && isDateValid(e) && s < e) {
213
+ this.date = d;
214
+ } else {
215
+ this.date = [];
216
+ }
217
+ } else {
218
+ let d = this.toDate(val);
219
+ this.date = isDateValid(d) ? d : null;
220
+ }
221
+ },
222
+ immediate: true,
223
+ },
224
+ isRange(val) {
225
+ /**
226
+ * Input event
227
+ * @property {String} date
228
+ */
229
+ this.$emit('input', val ? [] : '');
230
+ },
231
+ placeholder(placeholder) {
232
+ this.inputBinds = { ...this.inputBinds, placeholder };
233
+ },
234
+ },
235
+ computed: {
236
+ isRange() {
237
+ return !!this.datepicker.range;
238
+ },
239
+ valueLabel() {
240
+ return Array.isArray(this.value) ? this.value.join(this.delimiter) : this.value;
241
+ },
242
+ },
243
+ methods: {
244
+ clear() {
245
+ /**
246
+ * Input event
247
+ * @property {String} date
248
+ */
249
+ this.$emit('input', this.isRange ? [] : '');
250
+ /**
251
+ * Clear event
252
+ */
253
+ this.$emit('clear');
254
+ },
255
+ onRootFocus(e) {
256
+ let input = this.getInputRef();
257
+ input && input.focus();
258
+ },
259
+ onInputChange(e) {
260
+ let val = e.target.value;
261
+ let data = null;
262
+
263
+ if (this.isRange) {
264
+ let d = val.split(this.delimiter).map(this.toDate);
265
+ let [s, e] = d;
266
+ data = isDateValid(s) && isDateValid(e) && s < e ? d.map(this.toValue) : [];
267
+ } else {
268
+ let d = this.toDate(val);
269
+ data = isDateValid(d) ? this.toValue(d) : '';
270
+ }
271
+ /**
272
+ * Input event
273
+ * @property {String|Array} value
274
+ */
275
+ this.$emit('input', data);
276
+ /**
277
+ * Change event
278
+ * @property {String|Array} value
279
+ */
280
+ this.$emit('change', data);
281
+ },
282
+ onInputFocus(e) {
283
+ this.rootHasFocus = true;
284
+ },
285
+ onInputBlur(e) {
286
+ this.rootHasFocus = false;
287
+ },
288
+ onDpChange(date) {
289
+ let data = Array.isArray(date) ? date.map(this.toValue) : this.toValue(date);
290
+ /**
291
+ * Input event
292
+ * @property {String} date
293
+ */
294
+ this.$emit('input', data);
295
+ /**
296
+ * Change event
297
+ * @property {String} date
298
+ */
299
+ this.$emit('change', data);
300
+ },
301
+ onDpSetDate(date) {
302
+ /**
303
+ * Set date event
304
+ * @property {Date} date
305
+ */
306
+ this.$emit('set-date', date);
307
+ },
308
+ },
309
+ };
310
+ </script>