@community-release/nx-ui 0.0.4 → 0.0.7

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 (68) hide show
  1. package/dist/module.d.mts +7 -0
  2. package/dist/module.d.ts +7 -2
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +230 -9
  5. package/dist/runtime/components/accordion.vue +221 -0
  6. package/dist/runtime/components/animated-number/animateValue.d.ts +13 -0
  7. package/dist/runtime/components/animated-number/animateValue.mjs +56 -0
  8. package/dist/runtime/components/animated-number/index.vue +43 -0
  9. package/dist/runtime/components/button/index.vue +360 -0
  10. package/dist/runtime/components/button/index.vue.d.ts +81 -0
  11. package/dist/runtime/components/button/props.json +6 -0
  12. package/dist/runtime/components/card.vue +138 -0
  13. package/dist/runtime/components/checkbox.vue +227 -0
  14. package/dist/runtime/components/countdown/index.vue +64 -0
  15. package/dist/runtime/components/countdown/props.json +6 -0
  16. package/dist/runtime/components/filter/index.vue +140 -0
  17. package/dist/runtime/components/filter/props.json +4 -0
  18. package/dist/runtime/components/grid.vue +169 -0
  19. package/dist/runtime/components/grid.vue.d.ts +56 -0
  20. package/dist/runtime/components/helpers/Countdown.d.ts +0 -0
  21. package/dist/runtime/components/helpers/Countdown.mjs +143 -0
  22. package/dist/runtime/components/helpers/getEventCoord.d.ts +7 -0
  23. package/dist/runtime/components/helpers/getEventCoord.mjs +16 -0
  24. package/dist/runtime/components/helpers/isImageExist.d.ts +6 -0
  25. package/dist/runtime/components/helpers/isImageExist.mjs +20 -0
  26. package/dist/runtime/components/helpers/isMobileDevice.d.ts +5 -0
  27. package/dist/runtime/components/helpers/isMobileDevice.mjs +12 -0
  28. package/dist/runtime/components/helpers/isWebKit.d.ts +5 -0
  29. package/dist/runtime/components/helpers/isWebKit.mjs +12 -0
  30. package/dist/runtime/components/helpers/uniq.d.ts +2 -0
  31. package/dist/runtime/components/helpers/uniq.mjs +1 -0
  32. package/dist/runtime/components/icons/check.svg +1 -0
  33. package/dist/runtime/components/icons/check.white.svg +1 -0
  34. package/dist/runtime/components/impulse-indicator.vue +139 -0
  35. package/dist/runtime/components/impulse-indicator.vue.d.ts +21 -0
  36. package/dist/runtime/components/input/index.vue +241 -0
  37. package/dist/runtime/components/input/props.json +5 -0
  38. package/dist/runtime/components/label.vue +33 -0
  39. package/dist/runtime/components/loading.vue +91 -0
  40. package/dist/runtime/components/map/device-zoom-switch.vue +160 -0
  41. package/dist/runtime/components/map/index.vue +135 -0
  42. package/dist/runtime/components/map/location/index.vue +109 -0
  43. package/dist/runtime/components/map/location/list.vue +54 -0
  44. package/dist/runtime/components/map/location/nearest.vue +88 -0
  45. package/dist/runtime/components/map/openlayers/index.vue +355 -0
  46. package/dist/runtime/components/map/props.json +5 -0
  47. package/dist/runtime/components/map/store.d.ts +114 -0
  48. package/dist/runtime/components/map/store.mjs +166 -0
  49. package/dist/runtime/components/map/zoom.vue +61 -0
  50. package/dist/runtime/components/notice/index.vue +63 -0
  51. package/dist/runtime/components/notice/item.vue +118 -0
  52. package/dist/runtime/components/notice/store.d.ts +27 -0
  53. package/dist/runtime/components/notice/store.mjs +46 -0
  54. package/dist/runtime/components/radio.vue +215 -0
  55. package/dist/runtime/components/select.vue +303 -0
  56. package/dist/runtime/components/static-map.vue +345 -0
  57. package/dist/runtime/components/styles/components.less +3 -0
  58. package/dist/runtime/components/styles/mixins.less +6 -0
  59. package/dist/runtime/components/textarea/index.vue +166 -0
  60. package/dist/runtime/components/textarea/props.json +4 -0
  61. package/dist/runtime/components/tooltip.vue +137 -0
  62. package/dist/runtime/plugins/methods.d.ts +2 -0
  63. package/dist/runtime/plugins/methods.mjs +20 -0
  64. package/dist/runtime/plugins/variables.d.ts +2 -0
  65. package/dist/runtime/plugins/variables.mjs +17 -0
  66. package/dist/types.d.mts +2 -11
  67. package/dist/types.d.ts +2 -11
  68. package/package.json +2 -2
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <section class="component-ui-notice">
3
+ <transition-group name="list">
4
+ <div v-for="item in items" :key="item.id" class="component-ui-notice-wrapper">
5
+ <ui-notice-item
6
+ :id="item.id"
7
+ :duration="item.duration"
8
+ @remove="store.remove(item.id)"
9
+ >
10
+ <component :is="item.templateComponent" v-bind="item.templateProps"></component>
11
+ </ui-notice-item>
12
+ </div>
13
+ </transition-group>
14
+ </section>
15
+ </template>
16
+
17
+ <script setup>
18
+ import { storeToRefs } from 'pinia';
19
+ import { useUINoticeStore } from './store';
20
+ import UiNoticeItem from './item.vue';
21
+
22
+ const store = useUINoticeStore();
23
+ const { items } = storeToRefs(store);
24
+ </script>
25
+
26
+ <style lang="less">
27
+ @com-space-default: var(--ui-space-default);
28
+
29
+ .list-enter-active,
30
+ .list-leave-active {
31
+ transition: all 0.5s ease;
32
+ display: grid;
33
+ grid-template-rows: 1fr;
34
+ }
35
+
36
+ .list-enter-from,
37
+ .list-leave-to {
38
+ grid-template-rows: 0fr;
39
+
40
+ .component-ui-notice-item {
41
+ opacity: 0;
42
+ margin: 0;
43
+ padding: 0;
44
+ }
45
+ }
46
+
47
+ .component-ui-notice {
48
+ transform: translateX(-50%);
49
+ position: fixed;
50
+ bottom: @com-space-default;
51
+ left: 50%;
52
+ padding: 0 @com-space-default;
53
+
54
+ width: 500px;
55
+ max-width: 100%;
56
+
57
+ .component-ui-notice-wrapper {
58
+ .component-ui-notice-item {
59
+ overflow: hidden;
60
+ }
61
+ }
62
+ }
63
+ </style>
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <div class="component-ui-notice-item">
3
+ <slot></slot>
4
+
5
+ <i class="btn-close" @click="store.remove(id)">
6
+ <svg class="progress" width="32" height="32">
7
+ <circle cx="16" cy="16" r="14" />
8
+ </svg>
9
+ </i>
10
+ </div>
11
+ </template>
12
+
13
+ <script setup>
14
+ // Imports
15
+ import { useUINoticeStore } from './store';
16
+
17
+ // Data
18
+ const props = defineProps([
19
+ 'id', 'duration'
20
+ ]);
21
+
22
+ const store = useUINoticeStore();
23
+
24
+ const computedDuration = computed(() => {
25
+ return `${props.duration}ms`;
26
+ });
27
+
28
+ // Hooks
29
+ onMounted(() => {
30
+ // Remove notice after duration end
31
+ setTimeout(() => store.remove(props.id), props.duration);
32
+ });
33
+ </script>
34
+
35
+ <style lang="less">
36
+ @com-border-radius-default: var(--ui-border-radius-default);
37
+
38
+ @com-color-secondary: var(--ui-color-secondary);
39
+ @com-color-border: var(--ui-color-border);
40
+ @com-color-surface: var(--ui-color-surface);
41
+ @com-color-header-text: var(--ui-color-header-text);
42
+ @com-color-gray-text: var(--ui-color-gray-text);
43
+
44
+ @com-space-medium: var(--ui-space-medium);
45
+ @com-space-mini: var(--ui-space-mini);
46
+
47
+ @com-bs-2: var(--ui-bs-2);
48
+
49
+
50
+ @keyframes ui-notice-loading-circle {
51
+ 0% {
52
+ stroke-dashoffset: 88;
53
+ }
54
+ 100% {
55
+ stroke-dashoffset: 0;
56
+ }
57
+ }
58
+
59
+ .component-ui-notice-item {
60
+ --duration: v-bind(computedDuration);
61
+
62
+ transform-origin: center;
63
+ transition: all 0.5s ease;
64
+
65
+ position: relative;
66
+ margin-top: @com-space-mini;
67
+ padding: @com-space-medium;
68
+
69
+ border: 1px solid @com-color-border;
70
+ border-radius: @com-border-radius-default;
71
+ background: @com-color-surface;
72
+ box-shadow: @com-bs-2;
73
+
74
+ .btn-close {
75
+ position: absolute;
76
+ top: 10px;
77
+ right: 10px;
78
+
79
+ width: 32px;
80
+ height: 32px;
81
+ cursor: pointer;
82
+
83
+ &:before,
84
+ &:after {
85
+ content: '';
86
+
87
+ transform-origin: center;
88
+
89
+ position: absolute;
90
+ top: 50%;
91
+ left: 50%;
92
+
93
+ width: 12px;
94
+ height: 1px;
95
+
96
+ background: @com-color-header-text;
97
+ }
98
+
99
+ &:before { transform: translate3d(-50%, -50%, 0) rotate(45deg); }
100
+ &:after { transform: translate3d(-50%, -50%, 0) rotate(-45deg); }
101
+
102
+ circle {
103
+ transform: rotate(-90deg);
104
+ transform-origin: 50%;
105
+
106
+ fill: none;
107
+ stroke: @com-color-gray-text;
108
+ stroke: @com-color-secondary;
109
+ stroke-width: 1px;
110
+
111
+ stroke-dasharray: 88 88;
112
+ stroke-dashoffset: 88;
113
+
114
+ animation: ui-notice-loading-circle var(--duration) linear;
115
+ }
116
+ }
117
+ }
118
+ </style>
@@ -0,0 +1,27 @@
1
+ export const useUINoticeStore: import("pinia").StoreDefinition<"UINoticeStore", {
2
+ items: never[];
3
+ }, {}, {
4
+ /**
5
+ * Add item
6
+ * @param {NoticeItem} v
7
+ */
8
+ add(v: NoticeItem): string | number;
9
+ /**
10
+ * Remove item
11
+ * @param {string|number} id
12
+ */
13
+ remove(id: string | number): void;
14
+ }>;
15
+ /**
16
+ * NoticeItem
17
+ */
18
+ export type NoticeItem = {
19
+ /**
20
+ * - Item id
21
+ */
22
+ id?: string | number | undefined;
23
+ title: string;
24
+ message: string;
25
+ templateComponent: any;
26
+ templateProps: string;
27
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * NoticeItem
3
+ * @typedef {Object} NoticeItem
4
+ * @property {string|number} [id] - Item id
5
+ * @property {string} title
6
+ * @property {string} message
7
+ * @property {any} templateComponent
8
+ * @property {string} templateProps
9
+ */
10
+
11
+ import { defineStore } from 'pinia';
12
+
13
+ export const useUINoticeStore = defineStore('UINoticeStore', {
14
+ state: () => {
15
+ return {
16
+ items: [],
17
+ }
18
+ },
19
+
20
+ actions: {
21
+ /**
22
+ * Add item
23
+ * @param {NoticeItem} v
24
+ */
25
+ add(v) {
26
+ if (!v?.id) v.id = Math.random().toString(36).substr(2, 9);
27
+ if (!v?.duration) v.duration = 10000;
28
+
29
+ this.items.unshift(v);
30
+
31
+ return v.id;
32
+ },
33
+
34
+ /**
35
+ * Remove item
36
+ * @param {string|number} id
37
+ */
38
+ remove(id) {
39
+ for (let i=0; i < this.items.length; i++) {
40
+ if (this.items[i].id === id) {
41
+ this.items.splice(i--, 1);
42
+ }
43
+ }
44
+ },
45
+ },
46
+ });
@@ -0,0 +1,215 @@
1
+ <template>
2
+ <span class="component-ui component-ui-radio" :class="classes">
3
+ <label>
4
+ <input
5
+ ref="input"
6
+ type="radio"
7
+ :checked="isChecked"
8
+ :value="value"
9
+ :name="name"
10
+ :disabled="disabled"
11
+ autocomplete="off"
12
+ @change="handleUpdate($event.target.value)"
13
+ />
14
+
15
+ <i></i>
16
+
17
+ <span>
18
+ <slot></slot>
19
+ </span>
20
+ </label>
21
+ </span>
22
+ </template>
23
+
24
+ <script setup>
25
+ import { computed } from 'vue';
26
+
27
+ const props = defineProps({
28
+ name: {
29
+ required: false,
30
+ default: 'rd'
31
+ },
32
+ value: {
33
+ required: true,
34
+ },
35
+ modelValue: { default: '' },
36
+ haveError: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ required: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ disabled: {
45
+ type: Boolean,
46
+ default: false
47
+ }
48
+ })
49
+
50
+ const emit = defineEmits(['update:modelValue'])
51
+
52
+ const classes = computed(() => {
53
+ const ar = [];
54
+
55
+ if (props.value !== '') ar.push('tag-not-empty');
56
+ if (props.haveError) ar.push('tag-error');
57
+ if (props.text) ar.push('tag-text');
58
+ if (props.disabled) ar.push('tag-disabled');
59
+ if (props.required) ar.push('tag-required');
60
+
61
+ return ar;
62
+ });
63
+
64
+ const isChecked = computed(() => props.modelValue == props.value);
65
+
66
+ function handleUpdate(v) {
67
+ emit('update:modelValue', v);
68
+ }
69
+ </script>
70
+
71
+ <style lang="less">
72
+ .component-ui-radio {
73
+ @com-color-primary: var(--ui-color-primary);
74
+ @com-color-text-on-primar: var(--ui-color-text-on-primary);
75
+ @com-color-border: var(--ui-color-border);
76
+ @com-color-error: var(--ui-color-error);
77
+ @com-color-text: var(--ui-color-text);
78
+ @com-color-header-text: var(--ui-color-header-text);
79
+ @com-color-gray-text: var(--ui-color-gray-text);
80
+
81
+ @com-input-height: var(--ui-input-height-default);
82
+
83
+ @com-text-medium: var(--ui-text-medium);
84
+ @com-text-small: var(--ui-text-small);
85
+
86
+ @com-space-micro: var(--ui-space-micro);
87
+
88
+ @com-ani-time: var(--ui-ani-time);
89
+
90
+ position: relative;
91
+ display: inline-block;
92
+ text-align: left;
93
+
94
+ .error-wrap {
95
+ position: absolute;
96
+ top: 100%;
97
+ left: 0;
98
+ padding: 0;
99
+
100
+ font-size: 11px;
101
+
102
+ color: @com-color-error;
103
+ background: transparent;
104
+
105
+ &:before, &:after { display: none; }
106
+ }
107
+
108
+ > label {
109
+ position: relative;
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: left;
113
+ margin: 0;
114
+ padding: 0 0 0 30px;
115
+
116
+ height: @com-input-height;
117
+ line-height: @com-input-height;
118
+ font-size: @com-text-small;
119
+ font-weight: 500;
120
+ color: @com-color-text;
121
+
122
+ cursor: pointer;
123
+
124
+ > input {
125
+ position: absolute;
126
+ top: 0;
127
+ left: 0;
128
+ margin: 0;
129
+ padding: 0;
130
+ width: 100%;
131
+ height: 100%;
132
+ opacity: 0;
133
+ cursor: pointer;
134
+ }
135
+
136
+ > i {
137
+ transition: background 0.25s, border-color 0.25s;
138
+
139
+ position: absolute;
140
+ top: 50%;
141
+ left: 0;
142
+ margin-top: -9px;
143
+ width: 18px;
144
+ height: 18px;
145
+ line-height: 16px;
146
+ text-align: center;
147
+ font-size: 10px;
148
+
149
+ border-radius: 50%;
150
+ border: 1px solid @com-color-gray-text;
151
+
152
+ color: @com-color-text-on-primar;
153
+
154
+ &:before {
155
+ content: '';
156
+
157
+ transition: opacity @com-ani-time;
158
+
159
+ opacity: 0;
160
+
161
+ position: absolute;
162
+ inset: 0;
163
+ background-position: center;
164
+ background-repeat: no-repeat;
165
+ background-size: 10px;
166
+ background-image: url(./icons/check.white.svg);
167
+ }
168
+ }
169
+
170
+ > input:checked + i {
171
+ border-color: @com-color-primary;
172
+ background: @com-color-primary;
173
+
174
+ &:before {
175
+ opacity: 1;
176
+ }
177
+ }
178
+
179
+ > a {
180
+ pointer-events: none;
181
+ position: relative;
182
+ }
183
+
184
+ span {
185
+ color: @com-color-header-text;
186
+ }
187
+ }
188
+
189
+ // Required
190
+ &.tag-required {
191
+ span:after {
192
+ content: '*';
193
+ padding-left: @com-space-micro;
194
+ color: @com-color-error;
195
+ font-weight: bold;
196
+ font-size: @com-text-medium;
197
+ }
198
+ }
199
+
200
+ // Disabled
201
+ &.tag-disabled {
202
+ opacity: 0.6;
203
+
204
+ label,
205
+ input {
206
+ cursor: default;
207
+ }
208
+ }
209
+
210
+ // Error
211
+ &.tag-error {
212
+ > label { color: @com-color-error; }
213
+ }
214
+ }
215
+ </style>