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,51 +1,51 @@
1
- Simple example
2
-
3
- ```vue
4
- <template>
5
- <div class="pad-l5">
6
- <p>value: {{ model }}</p>
7
- <input-color-picker class="w-6-12" v-model="model" v-bind="props"></input-color-picker>
8
- </div>
9
- </template>
10
- <script>
11
- export default {
12
- data() {
13
- return {
14
- model: '#f00',
15
- props: {
16
- placeholder: 'Pick a color',
17
- },
18
- };
19
- },
20
- };
21
- </script>
22
- ```
23
-
24
- Advanced example. Slots
25
-
26
- ```vue
27
- <template>
28
- <div class="pad-l5">
29
- <p>value: {{ model }}</p>
30
- <input-color-picker class="w-6-12" v-model="model" v-bind="props">
31
- <template #icon="{ toggle, value }">
32
- <div class="icon cursor-pointer" @click="toggle">
33
- <i class="mdi mdi-palette mdi-18px"></i>
34
- </div>
35
- </template>
36
- </input-color-picker>
37
- </div>
38
- </template>
39
- <script>
40
- export default {
41
- data() {
42
- return {
43
- model: '#f00',
44
- props: {
45
- placeholder: 'Pick a color',
46
- },
47
- };
48
- },
49
- };
50
- </script>
51
- ```
1
+ Simple example
2
+
3
+ ```vue
4
+ <template>
5
+ <div class="pad-l5">
6
+ <p>value: {{ model }}</p>
7
+ <input-color-picker class="w-6-12" v-model="model" v-bind="props"></input-color-picker>
8
+ </div>
9
+ </template>
10
+ <script>
11
+ export default {
12
+ data() {
13
+ return {
14
+ model: '#f00',
15
+ props: {
16
+ placeholder: 'Pick a color',
17
+ },
18
+ };
19
+ },
20
+ };
21
+ </script>
22
+ ```
23
+
24
+ Advanced example. Slots
25
+
26
+ ```vue
27
+ <template>
28
+ <div class="pad-l5">
29
+ <p>value: {{ model }}</p>
30
+ <input-color-picker class="w-6-12" v-model="model" v-bind="props">
31
+ <template #icon="{ toggle, value }">
32
+ <div class="icon cursor-pointer" @click="toggle">
33
+ <i class="mdi mdi-palette mdi-18px"></i>
34
+ </div>
35
+ </template>
36
+ </input-color-picker>
37
+ </div>
38
+ </template>
39
+ <script>
40
+ export default {
41
+ data() {
42
+ return {
43
+ model: '#f00',
44
+ props: {
45
+ placeholder: 'Pick a color',
46
+ },
47
+ };
48
+ },
49
+ };
50
+ </script>
51
+ ```
@@ -1,151 +1,151 @@
1
- <template>
2
- <div
3
- class="ui-input-color-picker form-elem"
4
- :class="cssClass"
5
- @focus="onRootFocus"
6
- tabindex="0"
7
- :data-popover="popoverTargetId"
8
- >
9
- <div class="ui-input-color-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 {Object} inputBinds input props (use v-bind)
16
- @binding {Object} inputEvents input events (use v-on)
17
- -->
18
- <slot name="input" v-bind="{ id: inputId, value, inputBinds, inputEvents }">
19
- <input
20
- :id="inputId"
21
- class="ui-input-color-picker-input w-100"
22
- type="text"
23
- :value="value"
24
- v-bind="inputBinds"
25
- v-on="inputEvents"
26
- />
27
- </slot>
28
- </div>
29
- <!--
30
- @slot Icon slot
31
- @binding {String} value current value
32
- @binding {Function} toggle function that toggles the color picker
33
- -->
34
- <slot name="icon" v-bind="{ value, toggle: togglePopover }">
35
- <div
36
- class="ui-input-color-picker-icon-preview mar-left-2 cursor-pointer"
37
- :style="{ background: value }"
38
- @click="togglePopover"
39
- ></div>
40
- </slot>
41
- </div>
42
- <ui-popover :show.sync="popoverShow" v-bind="popoverOptions">
43
- <color-picker
44
- class="ui-input-color-picker-cp pull-left"
45
- v-bind="{
46
- value,
47
- colorsDefault,
48
- showSubmit: true,
49
- }"
50
- @submit="onSubmit"
51
- ></color-picker>
52
- </ui-popover>
53
- </div>
54
- </template>
55
- <style lang="less" scoped>
56
- .ui-input-color-picker {
57
- display: inline-flex;
58
- &-wrapper {
59
- display: flex;
60
- }
61
- &-icon-preview {
62
- width: 1em;
63
- height: 1em;
64
- border: 1px solid var(--color-border);
65
- background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKAQMAAAC3/F3+AAAAA3NCSVQICAjb4U/gAAAABlBMVEXM1dv///9zs4+jAAAACXBIWXMAAAsSAAALEgHS3X78AAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJljYD/AgIx+MCAjAHyDCLzvUxo8AAAAAElFTkSuQmCC');
66
- }
67
- &-input {
68
- border: none;
69
- margin: 0;
70
- padding: 0;
71
- line-height: 1.5;
72
- color: inherit;
73
- background: transparent;
74
- outline: none;
75
- }
76
- }
77
- </style>
78
- <script>
79
- import ColorPicker from './ColorPicker.vue';
80
- import UiPopover from './Popover.vue';
81
- import FormComponent from './utils/FormComponent';
82
- import WithPopover from './utils/WithPopover';
83
-
84
- export default {
85
- mixins: [FormComponent, WithPopover],
86
- components: { ColorPicker, UiPopover },
87
- props: {
88
- /**
89
- * Whether the input is editable
90
- */
91
- editable: {
92
- type: Boolean,
93
- default: true,
94
- },
95
- /**
96
- * Default colors palette
97
- */
98
- colorsDefault: {
99
- type: Array,
100
- default() {
101
- return [];
102
- },
103
- },
104
- },
105
- data() {
106
- return {
107
- inputBinds: {
108
- placeholder: this.placeholder,
109
- readonly: this.readonly || !this.editable,
110
- },
111
- inputEvents: {
112
- change: this.onInputChange,
113
- focus: this.onInputFocus,
114
- blur: this.onInputBlur,
115
- },
116
- };
117
- },
118
- methods: {
119
- changeColor(val) {
120
- /**
121
- * Input event
122
- * @property {String} color
123
- */
124
- this.$emit('input', val);
125
- /**
126
- * Change event
127
- * @property {String} color
128
- */
129
- this.$emit('change', val);
130
- },
131
- onRootFocus(e) {
132
- let input = this.getInputRef();
133
- input && input.focus();
134
- },
135
- onInputChange(e) {
136
- this.changeColor(e.target.value);
137
- },
138
- onInputFocus(e) {
139
- this.rootHasFocus = true;
140
- },
141
- onInputBlur(e) {
142
- this.rootHasFocus = false;
143
- },
144
- onSubmit({ rgba }) {
145
- let { r, g, b, a } = rgba;
146
- this.changeColor(`rgba(${r}, ${g}, ${b}, ${a})`);
147
- this.popoverShow = false;
148
- },
149
- },
150
- };
151
- </script>
1
+ <template>
2
+ <div
3
+ class="ui-input-color-picker form-elem"
4
+ :class="cssClass"
5
+ @focus="onRootFocus"
6
+ tabindex="0"
7
+ :data-popover="popoverTargetId"
8
+ >
9
+ <div class="ui-input-color-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 {Object} inputBinds input props (use v-bind)
16
+ @binding {Object} inputEvents input events (use v-on)
17
+ -->
18
+ <slot name="input" v-bind="{ id: inputId, value, inputBinds, inputEvents }">
19
+ <input
20
+ :id="inputId"
21
+ class="ui-input-color-picker-input w-100"
22
+ type="text"
23
+ :value="value"
24
+ v-bind="inputBinds"
25
+ v-on="inputEvents"
26
+ />
27
+ </slot>
28
+ </div>
29
+ <!--
30
+ @slot Icon slot
31
+ @binding {String} value current value
32
+ @binding {Function} toggle function that toggles the color picker
33
+ -->
34
+ <slot name="icon" v-bind="{ value, toggle: togglePopover }">
35
+ <div
36
+ class="ui-input-color-picker-icon-preview mar-left-2 cursor-pointer"
37
+ :style="{ background: value }"
38
+ @click="togglePopover"
39
+ ></div>
40
+ </slot>
41
+ </div>
42
+ <ui-popover :show.sync="popoverShow" v-bind="popoverOptions">
43
+ <color-picker
44
+ class="ui-input-color-picker-cp pull-left"
45
+ v-bind="{
46
+ value,
47
+ colorsDefault,
48
+ showSubmit: true,
49
+ }"
50
+ @submit="onSubmit"
51
+ ></color-picker>
52
+ </ui-popover>
53
+ </div>
54
+ </template>
55
+ <style lang="less" scoped>
56
+ .ui-input-color-picker {
57
+ display: inline-flex;
58
+ &-wrapper {
59
+ display: flex;
60
+ }
61
+ &-icon-preview {
62
+ width: 1em;
63
+ height: 1em;
64
+ border: 1px solid var(--color-border);
65
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKAQMAAAC3/F3+AAAAA3NCSVQICAjb4U/gAAAABlBMVEXM1dv///9zs4+jAAAACXBIWXMAAAsSAAALEgHS3X78AAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJljYD/AgIx+MCAjAHyDCLzvUxo8AAAAAElFTkSuQmCC');
66
+ }
67
+ &-input {
68
+ border: none;
69
+ margin: 0;
70
+ padding: 0;
71
+ line-height: 1.5;
72
+ color: inherit;
73
+ background: transparent;
74
+ outline: none;
75
+ }
76
+ }
77
+ </style>
78
+ <script>
79
+ import ColorPicker from './ColorPicker.vue';
80
+ import UiPopover from './Popover.vue';
81
+ import FormComponent from './utils/FormComponent';
82
+ import WithPopover from './utils/WithPopover';
83
+
84
+ export default {
85
+ mixins: [FormComponent, WithPopover],
86
+ components: { ColorPicker, UiPopover },
87
+ props: {
88
+ /**
89
+ * Whether the input is editable
90
+ */
91
+ editable: {
92
+ type: Boolean,
93
+ default: true,
94
+ },
95
+ /**
96
+ * Default colors palette
97
+ */
98
+ colorsDefault: {
99
+ type: Array,
100
+ default() {
101
+ return [];
102
+ },
103
+ },
104
+ },
105
+ data() {
106
+ return {
107
+ inputBinds: {
108
+ placeholder: this.placeholder,
109
+ readonly: this.readonly || !this.editable,
110
+ },
111
+ inputEvents: {
112
+ change: this.onInputChange,
113
+ focus: this.onInputFocus,
114
+ blur: this.onInputBlur,
115
+ },
116
+ };
117
+ },
118
+ methods: {
119
+ changeColor(val) {
120
+ /**
121
+ * Input event
122
+ * @property {String} color
123
+ */
124
+ this.$emit('input', val);
125
+ /**
126
+ * Change event
127
+ * @property {String} color
128
+ */
129
+ this.$emit('change', val);
130
+ },
131
+ onRootFocus(e) {
132
+ let input = this.getInputRef();
133
+ input && input.focus();
134
+ },
135
+ onInputChange(e) {
136
+ this.changeColor(e.target.value);
137
+ },
138
+ onInputFocus(e) {
139
+ this.rootHasFocus = true;
140
+ },
141
+ onInputBlur(e) {
142
+ this.rootHasFocus = false;
143
+ },
144
+ onSubmit({ rgba }) {
145
+ let { r, g, b, a } = rgba;
146
+ this.changeColor(`rgba(${r}, ${g}, ${b}, ${a})`);
147
+ this.popoverShow = false;
148
+ },
149
+ },
150
+ };
151
+ </script>
@@ -1,121 +1,121 @@
1
- Simple example
2
-
3
- ```vue
4
- <template>
5
- <div class="pad-l5">
6
- <p>value: {{ model }}</p>
7
- <div class="p">
8
- <label>
9
- <input
10
- class="checkbox checkbox-small"
11
- type="checkbox"
12
- v-model="props.datepicker.range"
13
- /><i></i>
14
- <span class="pad-left-2 v-mid">range</span>
15
- </label>
16
- </div>
17
- <input-date-picker class="w-6-12" v-model="model" v-bind="props"></input-date-picker>
18
- </div>
19
- </template>
20
- <script>
21
- export default {
22
- data() {
23
- return {
24
- model: '',
25
- props: {
26
- placeholder: 'Pick dates',
27
- datepicker: {
28
- range: false,
29
- },
30
- },
31
- };
32
- },
33
- };
34
- </script>
35
- ```
36
-
37
- Advanced example. Custom format, slots etc
38
-
39
- ```vue
40
- <template>
41
- <div class="pad-l5">
42
- <p>value: {{ model }}</p>
43
- <p>
44
- <input-date-picker class="w-6-12" v-model="model" v-bind="props" v-on="events">
45
- <template #clear="{ clear }">
46
- <b class="text-xsmall cursor-pointer color-red mar-h-2" @click="clear">clear</b>
47
- </template>
48
- <template #icon="{ toggle }">
49
- <b class="text-xsmall cursor-pointer" @click="toggle">DP</b>
50
- </template>
51
- <template #dp-left>
52
- <div class="mar-l1">
53
- <p v-for="n in offsets" :key="n">
54
- <span
55
- class="btn btn-small d-flex"
56
- :class="[offset == n ? 'btn-primary' : 'btn-ghost']"
57
- @click="setOffset(n)"
58
- >
59
- {{ n }} d
60
- </span>
61
- </p>
62
- </div>
63
- </template>
64
- </input-date-picker>
65
- </p>
66
- <pre style="height:8rem">{{ log }}</pre>
67
- </div>
68
- </template>
69
- <script>
70
- let dayjs = window.dayjs;
71
- dayjs.locale(window.dayjs_locale_ru);
72
- dayjs.extend(window.dayjs_plugin_customParseFormat);
73
-
74
- let format = 'DD MMM YYYY';
75
-
76
- export default {
77
- data() {
78
- return {
79
- log: '',
80
- offset: 0,
81
- offsets: [3, 7, 14],
82
- model: [],
83
- props: {
84
- placeholder: 'Pick a date',
85
- toDate(str) {
86
- return str ? dayjs(str, format).toDate() : null;
87
- },
88
- toValue(date) {
89
- return dayjs(date).format(format);
90
- },
91
- datepicker: {
92
- range: true,
93
- },
94
- },
95
- events: {
96
- clear: this.onClear,
97
- 'set-date': this.onSetDate,
98
- },
99
- };
100
- },
101
- methods: {
102
- onClear() {
103
- this.log = `event:clear\n` + this.log;
104
- },
105
- onSetDate(d) {
106
- let { toValue } = this.props;
107
- this.log = `event:set-date ${d}\n` + this.log;
108
- if (this.offset) {
109
- let d2 = dayjs(d)
110
- .add(this.offset, 'd')
111
- .toDate();
112
- this.model = [toValue(d), toValue(d2)];
113
- }
114
- },
115
- setOffset(n) {
116
- this.offset = this.offset == n ? 0 : n;
117
- },
118
- },
119
- };
120
- </script>
121
- ```
1
+ Simple example
2
+
3
+ ```vue
4
+ <template>
5
+ <div class="pad-l5">
6
+ <p>value: {{ model }}</p>
7
+ <div class="p">
8
+ <label>
9
+ <input
10
+ class="checkbox checkbox-small"
11
+ type="checkbox"
12
+ v-model="props.datepicker.range"
13
+ /><i></i>
14
+ <span class="pad-left-2 v-mid">range</span>
15
+ </label>
16
+ </div>
17
+ <input-date-picker class="w-6-12" v-model="model" v-bind="props"></input-date-picker>
18
+ </div>
19
+ </template>
20
+ <script>
21
+ export default {
22
+ data() {
23
+ return {
24
+ model: '',
25
+ props: {
26
+ placeholder: 'Pick dates',
27
+ datepicker: {
28
+ range: false,
29
+ },
30
+ },
31
+ };
32
+ },
33
+ };
34
+ </script>
35
+ ```
36
+
37
+ Advanced example. Custom format, slots etc
38
+
39
+ ```vue
40
+ <template>
41
+ <div class="pad-l5">
42
+ <p>value: {{ model }}</p>
43
+ <p>
44
+ <input-date-picker class="w-6-12" v-model="model" v-bind="props" v-on="events">
45
+ <template #clear="{ clear }">
46
+ <b class="text-xsmall cursor-pointer color-red mar-h-2" @click="clear">clear</b>
47
+ </template>
48
+ <template #icon="{ toggle }">
49
+ <b class="text-xsmall cursor-pointer" @click="toggle">DP</b>
50
+ </template>
51
+ <template #dp-left>
52
+ <div class="mar-l1">
53
+ <p v-for="n in offsets" :key="n">
54
+ <span
55
+ class="btn btn-small d-flex"
56
+ :class="[offset == n ? 'btn-primary' : 'btn-ghost']"
57
+ @click="setOffset(n)"
58
+ >
59
+ {{ n }} d
60
+ </span>
61
+ </p>
62
+ </div>
63
+ </template>
64
+ </input-date-picker>
65
+ </p>
66
+ <pre style="height:8rem">{{ log }}</pre>
67
+ </div>
68
+ </template>
69
+ <script>
70
+ let dayjs = window.dayjs;
71
+ dayjs.locale(window.dayjs_locale_ru);
72
+ dayjs.extend(window.dayjs_plugin_customParseFormat);
73
+
74
+ let format = 'DD MMM YYYY';
75
+
76
+ export default {
77
+ data() {
78
+ return {
79
+ log: '',
80
+ offset: 0,
81
+ offsets: [3, 7, 14],
82
+ model: [],
83
+ props: {
84
+ placeholder: 'Pick a date',
85
+ toDate(str) {
86
+ return str ? dayjs(str, format).toDate() : null;
87
+ },
88
+ toValue(date) {
89
+ return dayjs(date).format(format);
90
+ },
91
+ datepicker: {
92
+ range: true,
93
+ },
94
+ },
95
+ events: {
96
+ clear: this.onClear,
97
+ 'set-date': this.onSetDate,
98
+ },
99
+ };
100
+ },
101
+ methods: {
102
+ onClear() {
103
+ this.log = `event:clear\n` + this.log;
104
+ },
105
+ onSetDate(d) {
106
+ let { toValue } = this.props;
107
+ this.log = `event:set-date ${d}\n` + this.log;
108
+ if (this.offset) {
109
+ let d2 = dayjs(d)
110
+ .add(this.offset, 'd')
111
+ .toDate();
112
+ this.model = [toValue(d), toValue(d2)];
113
+ }
114
+ },
115
+ setOffset(n) {
116
+ this.offset = this.offset == n ? 0 : n;
117
+ },
118
+ },
119
+ };
120
+ </script>
121
+ ```