@vc-shell/framework 1.0.46 → 1.0.48

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 (62) hide show
  1. package/core/plugins/index.ts +2 -1
  2. package/core/plugins/moment/humanize.ts +77 -0
  3. package/core/plugins/moment/index.ts +1 -0
  4. package/core/plugins/moment/moment.ts +29 -0
  5. package/core/types/index.ts +10 -5
  6. package/dist/core/plugins/index.d.ts +2 -1
  7. package/dist/core/plugins/index.d.ts.map +1 -1
  8. package/dist/core/plugins/moment/humanize.d.ts +3 -0
  9. package/dist/core/plugins/moment/humanize.d.ts.map +1 -0
  10. package/dist/core/plugins/moment/index.d.ts +2 -0
  11. package/dist/core/plugins/moment/index.d.ts.map +1 -0
  12. package/dist/core/plugins/moment/moment.d.ts +13 -0
  13. package/dist/core/plugins/moment/moment.d.ts.map +1 -0
  14. package/dist/core/types/index.d.ts +12 -6
  15. package/dist/core/types/index.d.ts.map +1 -1
  16. package/dist/framework.js +96 -81
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/style.css +1 -1
  20. package/dist/tsconfig.tsbuildinfo +1 -1
  21. package/dist/ui/components/index.d.ts +0 -1
  22. package/dist/ui/components/index.d.ts.map +1 -1
  23. package/dist/ui/components/molecules/vc-input/index.d.ts +1 -1
  24. package/dist/ui/components/molecules/vc-input/index.d.ts.map +1 -1
  25. package/dist/ui/components/molecules/vc-input/vc-input-model.d.ts +1 -5
  26. package/dist/ui/components/molecules/vc-input/vc-input-model.d.ts.map +1 -1
  27. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency-model.d.ts +4 -10
  28. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency-model.d.ts.map +1 -1
  29. package/dist/ui/components/molecules/vc-select/index.d.ts.map +1 -1
  30. package/dist/ui/components/molecules/vc-select/vc-select-model.d.ts +5 -12
  31. package/dist/ui/components/molecules/vc-select/vc-select-model.d.ts.map +1 -1
  32. package/dist/ui/types/index.d.ts +6 -6
  33. package/dist/ui/types/index.d.ts.map +1 -1
  34. package/dist/ui/types/ts-helpers.d.ts +4 -5
  35. package/dist/ui/types/ts-helpers.d.ts.map +1 -1
  36. package/dist/vite.config.d.ts.map +1 -1
  37. package/package.json +4 -4
  38. package/ui/components/atoms/vc-icon/vc-icon.vue +1 -1
  39. package/ui/components/index.ts +0 -1
  40. package/ui/components/molecules/vc-input/index.ts +1 -1
  41. package/ui/components/molecules/vc-input/vc-input-model.ts +2 -5
  42. package/ui/components/molecules/vc-input/vc-input.vue +2 -2
  43. package/ui/components/molecules/vc-input-currency/vc-input-currency-model.ts +4 -10
  44. package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +2 -5
  45. package/ui/components/molecules/vc-select/index.ts +1 -0
  46. package/ui/components/molecules/vc-select/vc-select-model.ts +6 -13
  47. package/ui/components/molecules/vc-select/vc-select.vue +3 -2
  48. package/ui/components/molecules/vc-slider/vc-slider.vue +7 -3
  49. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +1 -1
  50. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +6 -8
  51. package/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +2 -0
  52. package/ui/components/organisms/vc-app/vc-app.vue +5 -1
  53. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +22 -36
  54. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +7 -5
  55. package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +9 -4
  56. package/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +2 -5
  57. package/ui/components/organisms/vc-table/vc-table.vue +80 -133
  58. package/ui/types/index.ts +5 -17
  59. package/ui/types/ts-helpers.ts +7 -21
  60. package/dist/framework.js.map +0 -1
  61. package/ui/components/molecules/vc-currency-input/vc-input.vue +0 -436
  62. package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +0 -447
@@ -1,436 +0,0 @@
1
- <template>
2
- <div
3
- class="vc-input"
4
- :class="[
5
- `vc-input_${type}`,
6
- {
7
- 'vc-input_clearable': clearable,
8
- 'vc-input_error': errorMessage,
9
- 'vc-input_disabled': disabled,
10
- },
11
- ]"
12
- >
13
- <!-- Input label -->
14
- <VcLabel v-if="label" class="tw-mb-2" :required="isRequired">
15
- <span>{{ label }}</span>
16
- <template v-if="tooltip" v-slot:tooltip>{{ tooltip }}</template>
17
- </VcLabel>
18
-
19
- <!-- Input field -->
20
- <div class="vc-input__field-wrapper">
21
- <input
22
- class="vc-input__field"
23
- :placeholder="placeholder"
24
- :type="internalType"
25
- :value="calcValue"
26
- :disabled="disabled"
27
- @input="onInput"
28
- @blur="$emit('blur')"
29
- ref="inputRef"
30
- :max="max"
31
- :name="name"
32
- :maxlength="maxchars"
33
- />
34
-
35
- <!-- Dropdown button -->
36
- <div v-if="options && options.length" class="vc-input__dropdown-wrap">
37
- <div
38
- @click.stop="showDrop"
39
- aria-describedby="tooltip"
40
- ref="toggleDropRef"
41
- :class="[
42
- { 'vc-input__dropdown-btn_disabled': disabled },
43
- 'vc-input__dropdown-btn',
44
- ]"
45
- >
46
- {{ optionsValue }}
47
- </div>
48
- <teleport to="#app">
49
- <div
50
- v-if="dropActive"
51
- ref="dropRef"
52
- role="tooltip"
53
- class="vc-input__dropdown"
54
- v-click-outside="closeDrop"
55
- >
56
- <p class="vc-input__dropdown-title">{{ optionsTitle }}</p>
57
- <input
58
- class="vc-input__dropdown-search"
59
- v-model="search"
60
- ref="searchInput"
61
- />
62
- <ul class="vc-input__dropdown-list">
63
- <li v-for="(item, i) in searchFilter" :key="i">
64
- <button
65
- @click="onItemSelect(item)"
66
- :class="[
67
- 'vc-input__dropdown-selector',
68
- {
69
- 'vc-input__dropdown-selector-active':
70
- item[displayProperty] === optionsValue,
71
- },
72
- ]"
73
- >
74
- {{ item[displayProperty] }}
75
- </button>
76
- </li>
77
- </ul>
78
- </div>
79
- </teleport>
80
- </div>
81
-
82
- <!-- Input clear button -->
83
- <div
84
- v-if="clearable && modelValue && !disabled && type !== 'password'"
85
- class="vc-input__clear"
86
- @click="onReset"
87
- >
88
- <VcIcon size="s" icon="fas fa-times"></VcIcon>
89
- </div>
90
-
91
- <div
92
- class="vc-input__showhide"
93
- v-if="type === 'password' && internalType === 'password'"
94
- @click="internalType = 'text'"
95
- >
96
- <VcIcon size="s" icon="fas fa-eye-slash"></VcIcon>
97
- </div>
98
-
99
- <div
100
- class="vc-input__showhide"
101
- v-if="type === 'password' && internalType === 'text'"
102
- @click="internalType = 'password'"
103
- >
104
- <VcIcon size="s" icon="fas fa-eye"></VcIcon>
105
- </div>
106
- </div>
107
-
108
- <slot v-if="errorMessage" name="error">
109
- <VcHint class="vc-input__error">
110
- {{ errorMessage }}
111
- </VcHint>
112
- </slot>
113
- <slot v-if="fieldDescription" name="error">
114
- <VcHint class="vc-input__desc">
115
- {{ fieldDescription }}
116
- </VcHint>
117
- </slot>
118
- </div>
119
- </template>
120
-
121
- <script lang="ts" setup>
122
- import {
123
- computed,
124
- getCurrentInstance,
125
- nextTick,
126
- onMounted,
127
- ref,
128
- unref,
129
- watch,
130
- } from "vue";
131
- import { VcIcon, VcLabel } from "@/ui/components";
132
- import { createPopper, Instance } from "@popperjs/core";
133
- import {
134
- useCurrencyInput,
135
- UseCurrencyInput,
136
- parse,
137
- CurrencyDisplay,
138
- } from "vue-currency-input";
139
- import { clickOutside as vClickOutside } from "@/core/directives";
140
-
141
- export type ValueType = string | number | Date | null;
142
-
143
- export interface Props {
144
- placeholder?: string;
145
- modelValue?: ValueType;
146
- clearable?: boolean;
147
- isRequired?: boolean;
148
- disabled?: boolean;
149
- type?: string;
150
- label?: string;
151
- tooltip?: string;
152
- name?: string;
153
- currency?: boolean;
154
- options?: Record<string, string>[];
155
- optionsTitle?: string;
156
- optionsValue?: string;
157
- keyProperty?: string;
158
- displayProperty?: string;
159
- fieldDescription?: string;
160
- maxchars?: string;
161
- max?: string | number;
162
- errorMessage?: string;
163
- }
164
-
165
- export interface Emits {
166
- (event: "update:modelValue", value: ValueType): void;
167
- (event: "update:optionsValue", value: string): void;
168
- (event: 'blur'): void;
169
- }
170
-
171
- const props = withDefaults(defineProps<Props>(), {
172
- placeholder: "",
173
- modelValue: null,
174
- clearable: false,
175
- isRequired: false,
176
- disabled: false,
177
- type: "text",
178
- name: "Field",
179
- currency: false,
180
- options: () => [],
181
- optionsTitle: "Select",
182
- optionsValue: "",
183
- keyProperty: "id",
184
- displayProperty: "title",
185
- fieldDescription: "",
186
- maxchars: "1024",
187
- });
188
-
189
- const emit = defineEmits<Emits>();
190
-
191
- let currencyConverter: UseCurrencyInput | undefined = undefined;
192
- const internalType = ref(unref(props.type));
193
- const toggleDropRef = ref();
194
- const dropRef = ref();
195
- const dropActive = ref(false);
196
- const instance = getCurrentInstance();
197
- const popper = ref<Instance>();
198
- const search = ref("");
199
- const searchInput = ref();
200
- const calcValue = computed(() => {
201
- if (props.currency) {
202
- return currencyConverter?.formattedValue.value;
203
- } else {
204
- return props.modelValue;
205
- }
206
- });
207
-
208
- // Init currency composable if input type === currency (created hook)
209
- if (props.currency) {
210
- currencyConverter = useCurrencyInput({
211
- currency: props.optionsValue || "USD",
212
- autoSign: false,
213
- currencyDisplay: CurrencyDisplay.hidden,
214
- });
215
- }
216
-
217
- onMounted(() => {
218
- if (!props.modelValue && props.currency) {
219
- currencyConverter && currencyConverter.setValue(null);
220
- }
221
- });
222
-
223
- // Change currency settings
224
- watch(
225
- () => props.optionsValue,
226
- (newVal) => {
227
- currencyConverter &&
228
- currencyConverter.setOptions({
229
- currency: newVal,
230
- autoSign: false,
231
- currencyDisplay: CurrencyDisplay.hidden,
232
- });
233
- }
234
- );
235
-
236
- const searchFilter = computed(() => {
237
- return props.options.filter((opt) =>
238
- opt[props.displayProperty]
239
- .toLowerCase()
240
- .includes(search.value.toLowerCase())
241
- );
242
- });
243
-
244
- const inputRef = currencyConverter && currencyConverter.inputRef;
245
-
246
- watch(
247
- () => props.modelValue,
248
- (value) => {
249
- let initialValue = unref(value);
250
- if (
251
- initialValue &&
252
- initialValue.toString().length >= parseInt(props.maxchars)
253
- ) {
254
- initialValue.toString().slice(0, parseInt(props.maxchars));
255
-
256
- return;
257
- }
258
-
259
- emit("update:modelValue", initialValue);
260
- }
261
- );
262
-
263
- function showDrop() {
264
- if (!dropActive.value && !props.disabled) {
265
- dropActive.value = true;
266
- nextTick(() => {
267
- searchInput.value.focus();
268
- popper.value = createPopper(toggleDropRef.value, dropRef.value, {
269
- placement: "bottom-end",
270
- modifiers: [
271
- {
272
- name: "offset",
273
- options: {
274
- offset: [13, 15],
275
- },
276
- },
277
- ],
278
- });
279
- });
280
- } else {
281
- closeDrop();
282
- }
283
- }
284
-
285
- function closeDrop() {
286
- dropActive.value = false;
287
- search.value = "";
288
- popper.value?.destroy();
289
- }
290
-
291
- function onItemSelect(item: { [x: string]: string }) {
292
- emit("update:optionsValue", item[props.keyProperty]);
293
- closeDrop();
294
- }
295
-
296
- // Handle input event to properly validate value and emit changes
297
- function onInput(e: Event) {
298
- const newValue = (e.target as HTMLInputElement).value;
299
- if (newValue) {
300
- if (props.currency) {
301
- const parsed = parse(newValue, { currency: props.optionsValue });
302
- emit("update:modelValue", parsed);
303
- } else {
304
- emit("update:modelValue", newValue);
305
- }
306
- } else {
307
- emit("update:modelValue", null);
308
- }
309
- }
310
-
311
- // Handle input event to propertly reset value and emit changes
312
- function onReset() {
313
- if (props.currency) {
314
- currencyConverter && currencyConverter.setValue(null);
315
- }
316
- emit("update:modelValue", null);
317
- }
318
- </script>
319
-
320
- <style lang="scss">
321
- :root {
322
- --input-height: 38px;
323
- --input-border-radius: 3px;
324
- --input-border-color: #d3dbe9;
325
- --input-border-color-error: #f14e4e;
326
- --input-background-color: #ffffff;
327
- --input-placeholder-color: #a5a5a5;
328
- --input-clear-color: #43b0e6;
329
- --input-clear-color-hover: #319ed4;
330
- }
331
-
332
- .vc-input {
333
- @apply tw-overflow-hidden;
334
-
335
- &_date,
336
- &_datetime-local {
337
- @apply tw-max-w-[220px];
338
-
339
- .vc-app_mobile & {
340
- @apply tw-max-w-full;
341
- }
342
- }
343
-
344
- &__field-wrapper {
345
- @apply tw-border tw-border-solid tw-border-[color:var(--input-border-color)]
346
- tw-rounded-[var(--input-border-radius)]
347
- tw-bg-[color:var(--input-background-color)] tw-flex tw-items-stretch;
348
- }
349
-
350
- &_error &__field-wrapper {
351
- @apply tw-border tw-border-solid tw-border-[color:var(--input-border-color-error)];
352
- }
353
-
354
- &__error {
355
- @apply tw-mt-1 [--hint-color:var(--input-border-color-error)];
356
- }
357
-
358
- &__desc {
359
- @apply tw-text-[color:var(--multivalue-placeholder-color)] tw-mt-1 tw-break-words tw-p-0;
360
- }
361
-
362
- &__field {
363
- @apply tw-border-none tw-outline-none tw-h-[var(--input-height)] tw-min-w-0 tw-box-border tw-grow tw-pl-3;
364
-
365
- &::-webkit-input-placeholder {
366
- @apply tw-text-[color:var(--input-placeholder-color)];
367
- }
368
-
369
- &::-moz-placeholder {
370
- @apply tw-text-[color:var(--input-placeholder-color)];
371
- }
372
-
373
- &::-ms-placeholder {
374
- @apply tw-text-[color:var(--input-placeholder-color)];
375
- }
376
-
377
- &::placeholder {
378
- @apply tw-text-[color:var(--input-placeholder-color)];
379
- }
380
-
381
- &::-ms-reveal,
382
- &::-ms-clear {
383
- @apply tw-hidden;
384
- }
385
- }
386
-
387
- &__clear {
388
- @apply tw-cursor-pointer tw-text-[color:var(--input-clear-color)] hover:tw-text-[color:var(--input-clear-color-hover)] tw-px-3 tw-flex tw-items-center;
389
- }
390
-
391
- &__showhide {
392
- @apply tw-cursor-pointer tw-text-[color:var(--input-placeholder-color)] hover:tw-text-[color:var(--input-clear-color-hover)] tw-px-3 tw-flex tw-items-center;
393
- }
394
-
395
- &__dropdown-wrap {
396
- @apply tw-relative tw-px-3 tw-flex tw-items-center;
397
- }
398
-
399
- &__dropdown-btn {
400
- @apply tw-text-[color:var(--input-clear-color)] tw-not-italic tw-font-medium tw-text-[13px] tw-leading-[20px] tw-cursor-pointer;
401
-
402
- &_disabled {
403
- @apply tw-text-[#7e8e9d] tw-cursor-default;
404
- }
405
- }
406
-
407
- &__dropdown {
408
- @apply tw-absolute tw-bg-white tw-shadow-[1px_1px_11px_rgba(141,152,163,0.6)] tw-rounded-[3px] tw-p-[11px] tw-w-[120px] tw-box-border;
409
- }
410
-
411
- &__dropdown-title {
412
- @apply tw-not-italic tw-font-normal tw-text-base tw-leading-[20px] tw-text-[#333333] tw-p-0 tw-mb-[7px];
413
- }
414
-
415
- &__dropdown-search {
416
- @apply tw-bg-white tw-border tw-border-solid tw-border-[#eaecf2] tw-box-border tw-rounded-[4px] tw-h-8 tw-w-full tw-outline-none tw-px-2;
417
- }
418
-
419
- &__dropdown-list {
420
- @apply tw-list-none tw-p-0 tw-mt-2;
421
- }
422
-
423
- &__dropdown-selector {
424
- @apply tw-border-none tw-bg-transparent tw-p-[9px] tw-text-left tw-w-full tw-cursor-pointer tw-text-lg tw-rounded-[3px] hover:tw-bg-[#eff7fc];
425
-
426
- &-active {
427
- @apply tw-bg-[#dfeef9];
428
- }
429
- }
430
-
431
- &_disabled &__field-wrapper,
432
- &_disabled &__field {
433
- @apply tw-bg-[#fafafa] tw-text-[#424242];
434
- }
435
- }
436
- </style>