@vc-shell/framework 1.0.45 → 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 (67) 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 +11 -6
  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 +13 -7
  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 +6 -13
  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 +7 -7
  38. package/shared/assets/components/assets-details/assets-details.vue +9 -10
  39. package/ui/components/atoms/vc-col/vc-col.vue +10 -6
  40. package/ui/components/atoms/vc-icon/vc-icon.vue +1 -1
  41. package/ui/components/index.ts +0 -1
  42. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +12 -5
  43. package/ui/components/molecules/vc-input/index.ts +1 -1
  44. package/ui/components/molecules/vc-input/vc-input-model.ts +2 -5
  45. package/ui/components/molecules/vc-input/vc-input.vue +2 -2
  46. package/ui/components/molecules/vc-input-currency/vc-input-currency-model.ts +4 -10
  47. package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +2 -5
  48. package/ui/components/molecules/vc-select/index.ts +1 -0
  49. package/ui/components/molecules/vc-select/vc-select-model.ts +16 -22
  50. package/ui/components/molecules/vc-select/vc-select.vue +3 -2
  51. package/ui/components/molecules/vc-slider/vc-slider.vue +10 -6
  52. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +1 -1
  53. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +3 -3
  54. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +6 -8
  55. package/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +2 -0
  56. package/ui/components/organisms/vc-app/vc-app.vue +5 -1
  57. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +22 -36
  58. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +7 -5
  59. package/ui/components/organisms/vc-blade/vc-blade.vue +5 -2
  60. package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +20 -15
  61. package/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +12 -11
  62. package/ui/components/organisms/vc-table/vc-table.vue +92 -141
  63. package/ui/types/index.ts +5 -17
  64. package/ui/types/ts-helpers.ts +7 -21
  65. package/dist/framework.js.map +0 -1
  66. package/ui/components/molecules/vc-currency-input/vc-input.vue +0 -436
  67. package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +0 -447
@@ -1,447 +0,0 @@
1
- <template>
2
- <div
3
- class="vc-multivalue"
4
- :class="[
5
- `vc-multivalue_${type}`,
6
- {
7
- 'vc-multivalue_opened': isOpened,
8
- 'vc-multivalue_error': errorMessage,
9
- 'vc-multivalue_disabled': disabled
10
- },
11
- ]"
12
- >
13
- <!-- Input label -->
14
- <VcLabel v-if="label" class="tw-mb-2" :required="required">
15
- <span>{{ label }}</span>
16
- <template v-if="tooltip" v-slot:tooltip>{{ tooltip }}</template>
17
- </VcLabel>
18
-
19
- <!-- Input field -->
20
- <div class="vc-multivalue__field-wrapper" ref="inputFieldWrapRef">
21
- <div
22
- v-for="(item, i) in modelValue"
23
- :key="item.id"
24
- class="vc-multivalue__field-value-wrapper"
25
- >
26
- <div class="vc-multivalue__field-value">
27
- <span
28
- class="tw-truncate"
29
- :title="
30
- type === 'number' ? Number(item.value).toFixed(3) : item.value
31
- "
32
- >{{
33
- type === "number" ? Number(item.value).toFixed(3) : item.value
34
- }}</span
35
- >
36
- <VcIcon
37
- v-if="!disabled"
38
- class="vc-multivalue__field-value-clear"
39
- icon="fas fa-times"
40
- size="s"
41
- @click="onDelete(i)"
42
- ></VcIcon>
43
- </div>
44
- </div>
45
-
46
- <template v-if="multivalue">
47
- <div
48
- ref="dropdownToggleRef"
49
- class="vc-multivalue__field vc-multivalue__field_dictionary tw-grow tw-basis-0 tw-p-2"
50
- >
51
- <VcButton small @click.stop="toggleDropdown">Add +</VcButton>
52
- <teleport to="#app">
53
- <div
54
- v-if="isOpened"
55
- class="vc-multivalue__dropdown"
56
- ref="dropdownRef"
57
- v-click-outside="closeDropdown"
58
- >
59
- <input
60
- ref="search"
61
- class="vc-multivalue__search"
62
- @input="onSearch"
63
- />
64
-
65
- <VcContainer :no-padding="true">
66
- <div
67
- class="vc-multivalue__item"
68
- v-for="(item, i) in slicedDictionary"
69
- :key="i"
70
- @click="onItemSelect(item)"
71
- >
72
- <slot name="item" :item="item">{{
73
- item[displayProperty]
74
- }}</slot>
75
- </div>
76
- </VcContainer>
77
- </div>
78
- </teleport>
79
- </div>
80
- </template>
81
- <template v-else>
82
- <input
83
- class="vc-multivalue__field tw-grow tw-basis-0 tw-pl-3"
84
- :placeholder="placeholder"
85
- :type="type"
86
- :value="value"
87
- :disabled="disabled"
88
- @keypress.enter="onInput"
89
- />
90
- </template>
91
- </div>
92
-
93
- <slot v-if="errorMessage" name="error">
94
- <VcHint class="vc-multivalue__error tw-mt-1">
95
- {{ errorMessage }}
96
- </VcHint>
97
- </slot>
98
- </div>
99
- </template>
100
-
101
- <script lang="ts" setup>
102
- import { unref, getCurrentInstance, nextTick, ref, computed } from "vue";
103
-
104
- import { useField } from "vee-validate";
105
- import { VcLabel, VcIcon } from "@/ui/components";
106
- import { IValidationRules } from "@/core/types";
107
- import { createPopper, Instance, State } from "@popperjs/core";
108
- import { clickOutside as vClickOutside } from "@/core/directives";
109
-
110
- const props = defineProps({
111
- placeholder: {
112
- type: String,
113
- default: "",
114
- },
115
-
116
- modelValue: {
117
- type: Array,
118
- default: () => [],
119
- },
120
-
121
- required: {
122
- type: Boolean,
123
- default: false,
124
- },
125
-
126
- disabled: {
127
- type: Boolean,
128
- default: false,
129
- },
130
-
131
- type: {
132
- type: String,
133
- default: "text",
134
- },
135
-
136
- label: {
137
- type: String,
138
- default: undefined,
139
- },
140
-
141
- tooltip: {
142
- type: String,
143
- default: undefined,
144
- },
145
-
146
- name: {
147
- type: String,
148
- default: "Field",
149
- },
150
-
151
- options: {
152
- type: Array,
153
- default: () => [],
154
- },
155
-
156
- keyProperty: {
157
- type: String,
158
- default: "id",
159
- },
160
-
161
- displayProperty: {
162
- type: String,
163
- default: "title",
164
- },
165
-
166
- multivalue: {
167
- type: Boolean,
168
- default: false,
169
- },
170
-
171
- errorMessage: {
172
- type: String,
173
- default: undefined
174
- }
175
- });
176
-
177
- const emit = defineEmits(["update:modelValue", "search", "close"]);
178
-
179
- const instance = getCurrentInstance();
180
- const popper = ref<Instance>();
181
- const dropdownToggleRef = ref();
182
- const dropdownRef = ref();
183
- const inputFieldWrapRef = ref();
184
- const isOpened = ref(false);
185
- const search = ref();
186
-
187
- const slicedDictionary = computed(() => {
188
- return props.options?.filter((x) => {
189
- return !props.modelValue?.find(
190
- (item) =>
191
- (item as { valueId: string }).valueId === (x as { id: string }).id
192
- );
193
- });
194
- });
195
-
196
- // Handle input event to propertly validate value and emit changes
197
- function onInput(e: InputEvent) {
198
- const newValue = (e.target as HTMLInputElement).value;
199
- emit("update:modelValue", [...props.modelValue, { value: newValue }]);
200
- // handleChange("");
201
- }
202
-
203
- function onItemSelect(item: { [x: string]: string }) {
204
- emit("update:modelValue", [
205
- ...props.modelValue,
206
- { valueId: item[props.keyProperty] },
207
- ]);
208
- emit("close");
209
- closeDropdown();
210
- }
211
-
212
- // Handle event to propertly remove particular value and emit changes
213
- function onDelete(i: number) {
214
- const result = unref(props.modelValue);
215
- result.splice(i, 1);
216
- emit("update:modelValue", [...result]);
217
- }
218
-
219
- function toggleDropdown() {
220
- if (!props.disabled) {
221
- if (isOpened.value) {
222
- isOpened.value = false;
223
- popper.value?.destroy();
224
- inputFieldWrapRef.value.style.borderRadius =
225
- "var(--select-border-radius)";
226
- emit("close");
227
- } else {
228
- isOpened.value = true;
229
- nextTick(() => {
230
- search?.value?.focus();
231
- popper.value = createPopper(
232
- inputFieldWrapRef.value,
233
- dropdownRef.value,
234
- {
235
- placement: "bottom",
236
- modifiers: [
237
- {
238
- name: "flip",
239
- options: {
240
- fallbackPlacements: ["top", "bottom"],
241
- },
242
- },
243
- {
244
- name: "preventOverflow",
245
- options: {
246
- mainAxis: false,
247
- },
248
- },
249
- {
250
- name: "sameWidthChangeBorders",
251
- enabled: true,
252
- phase: "beforeWrite",
253
- requires: ["computeStyles"],
254
- fn: ({ state }: { state: State }) => {
255
- const placement = state.placement;
256
- if (placement === "top") {
257
- state.styles.popper.borderTop =
258
- "1px solid var(--select-border-color)";
259
- state.styles.popper.borderBottom =
260
- "1px solid var(--select-background-color)";
261
- state.styles.popper.borderRadius =
262
- "var(--select-border-radius) var(--select-border-radius) 0 0";
263
- inputFieldWrapRef.value.style.borderRadius =
264
- "0 0 var(--select-border-radius) var(--select-border-radius)";
265
- } else {
266
- state.styles.popper.borderBottom =
267
- "1px solid var(--select-border-color)";
268
- state.styles.popper.borderTop =
269
- "1px solid var(--select-background-color)";
270
- state.styles.popper.borderRadius =
271
- "0 0 var(--select-border-radius) var(--select-border-radius)";
272
-
273
- if (inputFieldWrapRef.value) {
274
- inputFieldWrapRef.value.style.borderRadius =
275
- "var(--select-border-radius) var(--select-border-radius) 0 0";
276
- }
277
- }
278
- state.styles.popper.width = `${state.rects.reference.width}px`;
279
- },
280
- effect: ({ state }: { state: State }) => {
281
- const ref = state.elements.reference as HTMLElement;
282
- const placement = state.placement;
283
- if (placement === "top") {
284
- state.elements.popper.style.borderTop =
285
- "1px solid var(--select-border-color)";
286
- state.elements.popper.style.borderBottom =
287
- "1px solid var(--select-background-color)";
288
- state.elements.popper.style.borderRadius =
289
- "var(--select-border-radius) var(--select-border-radius) 0 0";
290
- inputFieldWrapRef.value.style.borderRadius =
291
- "0 0 var(--select-border-radius) var(--select-border-radius)";
292
- } else {
293
- state.elements.popper.style.borderBottom =
294
- "1px solid var(--select-border-color)";
295
- state.elements.popper.style.borderTop =
296
- "1px solid var(--select-background-color)";
297
- state.elements.popper.style.borderRadius =
298
- "0 0 var(--select-border-radius) var(--select-border-radius)";
299
-
300
- if (inputFieldWrapRef.value) {
301
- inputFieldWrapRef.value.style.borderRadius =
302
- "var(--select-border-radius) var(--select-border-radius) 0 0";
303
- }
304
- }
305
- state.elements.popper.style.width = `${ref.offsetWidth}px`;
306
- },
307
- },
308
- {
309
- name: "offset",
310
- options: {
311
- offset: [0, -1],
312
- },
313
- },
314
- ],
315
- }
316
- );
317
- });
318
- }
319
- }
320
- }
321
-
322
- function closeDropdown() {
323
- isOpened.value = false;
324
- popper.value?.destroy();
325
- inputFieldWrapRef.value.style.borderRadius = "var(--select-border-radius)";
326
- emit("close");
327
- }
328
-
329
- function onSearch(event: InputEvent) {
330
- emit("search", (event.target as HTMLInputElement).value);
331
- }
332
- </script>
333
-
334
- <style lang="scss">
335
- :root {
336
- --multivalue-height: 38px;
337
- --multivalue-border-radius: 3px;
338
- --multivalue-border-color: #d3dbe9;
339
- --multivalue-border-color-error: #f14e4e;
340
- --multivalue-background-color: #ffffff;
341
- --multivalue-placeholder-color: #a5a5a5;
342
-
343
- --select-height: 38px;
344
- --select-border-radius: 3px;
345
- --select-border-color: #d3dbe9;
346
- --select-border-color-error: #f14e4e;
347
- --select-background-color: #ffffff;
348
- --select-background-color-disabled: #fafafa;
349
- --select-placeholder-color: #a5a5a5;
350
- --select-chevron-color: #43b0e6;
351
- --select-chevron-color-hover: #319ed4;
352
- }
353
-
354
- .vc-multivalue {
355
- @apply tw-overflow-hidden;
356
-
357
- &_date,
358
- &_datetime-local {
359
- @apply tw-max-w-[220px];
360
-
361
- .vc-app_mobile & {
362
- @apply tw-max-w-full;
363
- }
364
- }
365
-
366
- &__field-wrapper {
367
- @apply tw-border tw-border-solid
368
- tw-border-[color:var(--multivalue-border-color)]
369
- tw-rounded-[var(--multivalue-border-radius)]
370
- tw-bg-[color:var(--multivalue-background-color)]
371
- tw-items-center
372
- tw-flex
373
- tw-flex-wrap;
374
- }
375
-
376
- &__dropdown {
377
- @apply tw-flex tw-flex-col tw-box-border
378
- tw-max-h-[300px] tw-z-10 tw-overflow-hidden
379
- tw-absolute tw-bg-[color:var(--select-background-color)]
380
- tw-border tw-border-solid tw-border-[color:var(--select-border-color)]
381
- tw-border-t-[color:var(--select-background-color)]
382
- tw-rounded-b-[var(--select-border-radius)]
383
- tw-p-2;
384
- }
385
-
386
- &__search {
387
- @apply tw-w-full tw-box-border tw-border tw-border-solid tw-border-[#eaecf2]
388
- tw-rounded-[4px] tw-h-8 tw-leading-[32px]
389
- tw-outline-none tw-mb-3 tw-px-2;
390
- }
391
-
392
- &__item {
393
- @apply tw-flex tw-items-center tw-min-h-[36px] tw-px-2 tw-rounded-[3px] tw-cursor-pointer hover:tw-bg-[#eff7fc];
394
- }
395
-
396
- &_opened &__field-wrapper {
397
- @apply tw-rounded-t-[var(--select-border-radius)];
398
- }
399
-
400
- &_error &__field-wrapper {
401
- @apply tw-border tw-border-solid tw-border-[color:var(--multivalue-border-color-error)];
402
- }
403
-
404
- &__error {
405
- @apply tw-text-[color:var(--multivalue-border-color-error)];
406
- }
407
-
408
- &__field {
409
- @apply tw-border-none tw-outline-none tw-h-[var(--multivalue-height)]
410
- tw-min-w-[120px] tw-box-border placeholder:tw-text-[color:var(--multivalue-placeholder-color)];
411
-
412
- &::-webkit-input-placeholder {
413
- @apply tw-text-[color:var(--multivalue-placeholder-color)];
414
- }
415
-
416
- &::-moz-placeholder {
417
- @apply tw-text-[color:var(--multivalue-placeholder-color)];
418
- }
419
-
420
- &::-ms-placeholder {
421
- @apply tw-text-[color:var(--multivalue-placeholder-color)];
422
- }
423
-
424
- &-value-wrapper {
425
- @apply tw-h-[var(--multivalue-height)] tw-ml-2 tw-flex tw-items-center;
426
- }
427
-
428
- &-value {
429
- @apply tw-bg-[#fbfdfe] tw-border tw-border-solid tw-border-[color:#bdd1df] tw-rounded-[2px]
430
- tw-flex tw-items-center tw-h-[28px] tw-box-border tw-px-2 tw-max-w-[150px];
431
-
432
- &-clear {
433
- @apply tw-text-[#a9bfd2] tw-ml-2 tw-cursor-pointer;
434
- }
435
- }
436
-
437
- &_dictionary {
438
- @apply tw-h-auto tw-min-w-[auto];
439
- }
440
- }
441
-
442
- &_disabled &__field-wrapper,
443
- &_disabled &__field {
444
- @apply tw-bg-[#fafafa] tw-text-[#424242];
445
- }
446
- }
447
- </style>