vueless 0.0.49 → 0.0.50

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.
@@ -7,6 +7,7 @@ import tableConfig from "../../ui.data-table/configs/default.config";
7
7
  import calendarConfig from "../../ui.form-calendar/configs/default.config";
8
8
  import datepickerConfig from "../../ui.form-date-picker/configs/default.config";
9
9
  import datepickerRangeConfig from "../../ui.form-date-picker-range/configs/default.config";
10
+ import dataListConfig from "../../ui.data-list/configs/default.config";
10
11
 
11
12
  export default {
12
13
  USelect: selectConfig.i18n,
@@ -18,4 +19,5 @@ export default {
18
19
  UCalendar: calendarConfig.i18n,
19
20
  UDatePicker: datepickerConfig.i18n,
20
21
  UDatePickerRange: datepickerRangeConfig.i18n,
22
+ UDataList: dataListConfig.i18n,
21
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -43,7 +43,7 @@
43
43
 
44
44
  <UButton
45
45
  v-if="cancelButton"
46
- :label="props.config?.i18n?.cancel || t('UModalConfirm.cancel')"
46
+ :label="currentLocale.cancel"
47
47
  variant="thirdary"
48
48
  filled
49
49
  :data-cy="`${dataCy}-close`"
@@ -61,6 +61,7 @@
61
61
 
62
62
  <script setup>
63
63
  import { computed } from "vue";
64
+ import { merge } from "lodash-es";
64
65
 
65
66
  import UIService from "../service.ui";
66
67
 
@@ -153,7 +154,7 @@ const props = defineProps({
153
154
 
154
155
  const emit = defineEmits(["update:modelValue", "confirm", "close"]);
155
156
 
156
- const { t } = useLocale();
157
+ const { tm } = useLocale();
157
158
 
158
159
  const {
159
160
  hasSlotContent,
@@ -168,6 +169,8 @@ const isShownModal = computed({
168
169
  set: (value) => emit("update:modelValue", value),
169
170
  });
170
171
 
172
+ const currentLocale = computed(() => merge(tm("UModalConfirm"), props.config.i18n));
173
+
171
174
  function closeModal() {
172
175
  isShownModal.value = false;
173
176
  }
@@ -23,6 +23,10 @@ export default /*tw*/ {
23
23
  iconEdit: "fill-gray-500 opacity-50",
24
24
  iconEditName: "edit_note",
25
25
  nested: "group/nested ml-6",
26
+ i18n: {
27
+ delete: "Delete",
28
+ edit: "Edit",
29
+ },
26
30
  defaultVariants: {
27
31
  animationDuration: 200,
28
32
  nesting: false,
@@ -48,7 +48,7 @@
48
48
  :name="config.iconDeleteName"
49
49
  color="gray"
50
50
  :data-cy="`${dataCy}-delete`"
51
- :tooltip="$t('button.delete')"
51
+ :tooltip="currentLocale.delete"
52
52
  v-bind="iconDeleteAttrs"
53
53
  @click="onClickDelete(element.id, element.name)"
54
54
  />
@@ -59,7 +59,7 @@
59
59
  :name="config.iconEditName"
60
60
  color="gray"
61
61
  :data-cy="`${dataCy}-edit`"
62
- :tooltip="$t('button.edit')"
62
+ :tooltip="currentLocale.edit"
63
63
  v-bind="iconEditAttrs"
64
64
  @click="onClickEdit(element.id)"
65
65
  />
@@ -96,7 +96,9 @@
96
96
  </template>
97
97
 
98
98
  <script setup>
99
+ import { computed } from "vue";
99
100
  import draggable from "vuedraggable";
101
+ import { merge } from "lodash-es";
100
102
 
101
103
  import UIcon from "../ui.image-icon";
102
104
  import UEmpty from "../ui.text-empty";
@@ -106,6 +108,7 @@ import UIService from "../service.ui";
106
108
  import { UDataListName } from "./constants";
107
109
  import defaultConfig from "./configs/default.config";
108
110
  import { useAttrs } from "./composables/attrs.composable";
111
+ import { useLocale } from "../composable.locale";
109
112
 
110
113
  /* Should be a string for correct web-types gen */
111
114
  defineOptions({ name: "UDataList", inheritAttrs: true });
@@ -211,6 +214,9 @@ const {
211
214
  iconDragAttrs,
212
215
  hasSlotContent,
213
216
  } = useAttrs(props);
217
+ const { tm } = useLocale();
218
+
219
+ const currentLocale = computed(() => merge(tm("UDataList"), props.config.i18n));
214
220
 
215
221
  function onDragMove(event) {
216
222
  const isDisabledNestingItem = event.draggedContext.element.isDisabledNesting;
@@ -272,6 +272,7 @@ import {
272
272
  nextTick,
273
273
  onBeforeUnmount,
274
274
  } from "vue";
275
+ import { merge } from "lodash-es";
275
276
 
276
277
  import UIcon from "../ui.image-icon";
277
278
  import UEmpty from "../ui.text-empty";
@@ -404,7 +405,7 @@ const emit = defineEmits(["clickRow", "update:rows"]);
404
405
  defineExpose({ clearSelectedItems });
405
406
 
406
407
  const slots = useSlots();
407
- const { t } = useLocale();
408
+ const { tm } = useLocale();
408
409
 
409
410
  const selectAll = ref(false);
410
411
  const canSelectAll = ref(true);
@@ -475,6 +476,8 @@ const {
475
476
  headerAttrs,
476
477
  } = useAttrs(props, { selectedRows, isHeaderSticky, tableRows, isFooterSticky });
477
478
 
479
+ const currentLocale = computed(() => merge(tm("UTable"), props.config.i18n));
480
+
478
481
  const normalizedColumns = computed(() => TableService.normalizeColumns(props.columns));
479
482
 
480
483
  const isSelectedAllRows = computed(() => {
@@ -519,9 +522,7 @@ const hasContentBeforeFirstRowSlot = computed(() => {
519
522
  });
520
523
 
521
524
  const emptyTableMsg = computed(() => {
522
- return props.filters
523
- ? props.config?.i18n?.noResultsForFilters || t("UTable.noResultsForFilters")
524
- : props.config?.i18n?.noItems || t("UTable.noItems");
525
+ return props.filters ? currentLocale.value.noResultsForFilters : currentLocale.value.noItems;
525
526
  });
526
527
 
527
528
  watch(selectAll, onChangeSelectAll, { deep: true });
@@ -65,7 +65,7 @@
65
65
  :empty-styles="optionClasses"
66
66
  >
67
67
  <span v-bind="optionAttrs()">
68
- <span v-text="props.config?.i18n?.noDataToShow || t('UDropdownList.noDataToShow')" />
68
+ <span v-text="currentLocale.noDataToShow" />
69
69
  </span>
70
70
  </slot>
71
71
 
@@ -73,7 +73,7 @@
73
73
  <template v-if="addOption">
74
74
  <div v-bind="addTitleWrapperAttrs" @click="onClickAddOption">
75
75
  <div v-bind="addTitleAttrs">
76
- {{ props.config?.i18n?.add || t("UDropdownList.add") }}
76
+ {{ currentLocale.add }}
77
77
  <span v-bind="addTitleHotkeyAttrs" v-text="addOptionKeyCombination" />
78
78
  </div>
79
79
  </div>
@@ -87,6 +87,7 @@
87
87
 
88
88
  <script setup>
89
89
  import { computed, ref } from "vue";
90
+ import { merge } from "lodash-es";
90
91
 
91
92
  import UIcon from "../ui.image-icon";
92
93
  import UButton from "../ui.button";
@@ -231,10 +232,12 @@ const {
231
232
  optionContentAttrs,
232
233
  } = useAttrs(props);
233
234
 
234
- const { t } = useLocale();
235
+ const { tm } = useLocale();
235
236
 
236
237
  defineExpose({ pointerSet, pointerBackward, pointerForward, pointerReset, addPointerElement });
237
238
 
239
+ const currentLocale = computed(() => merge(tm("UDropdownList"), props.config.i18n));
240
+
238
241
  const addOptionKeyCombination = computed(() => {
239
242
  return isMac ? "(⌘ + Enter)" : "(Ctrl + Enter)";
240
243
  });
@@ -633,7 +633,7 @@ function onClickPeriodButton(periodName) {
633
633
  localValue.value.from !== null ? getDateFromUnixTimestamp(localValue.value.from) : new Date();
634
634
 
635
635
  if (periodName === PERIOD.week) {
636
- periodDateList.value = getWeekDateList(localDate, config.value.i18n.months.shorthand);
636
+ periodDateList.value = getWeekDateList(localDate, locale.value.months.shorthand);
637
637
 
638
638
  period.value = PERIOD.week;
639
639
  }
@@ -36,7 +36,7 @@
36
36
  </div>
37
37
 
38
38
  <UButton
39
- :label="props.config?.i18n?.selectFile || t('UInputFile.selectFile')"
39
+ :label="currentLocale.selectFile"
40
40
  :size="size"
41
41
  variant="thirdary"
42
42
  filled
@@ -61,6 +61,7 @@
61
61
  <script setup>
62
62
  import Uppy from "@uppy/core";
63
63
  import DragDrop from "@uppy/vue/src/drag-drop";
64
+ import { merge } from "lodash-es";
64
65
 
65
66
  import { computed, onBeforeUnmount, onMounted, ref, useSlots, watch } from "vue";
66
67
 
@@ -192,7 +193,7 @@ const slots = useSlots();
192
193
 
193
194
  const emit = defineEmits(["changeFiles", "deleteFile"]);
194
195
 
195
- const { t } = useLocale();
196
+ const { tm } = useLocale();
196
197
 
197
198
  const filesData = ref([]);
198
199
  const selectedFiles = ref([]);
@@ -217,6 +218,8 @@ const {
217
218
  hasSlotContent,
218
219
  } = useAttrs(props, { errorMessage, dragOver });
219
220
 
221
+ const currentLocale = computed(() => merge(tm("UInputFile"), props.config.i18n));
222
+
220
223
  const filesList = computed(() => {
221
224
  return filesData.value.map((file) => {
222
225
  return {
@@ -245,11 +248,11 @@ const uppyUpload = computed(() => {
245
248
  const allowedFilesForUpload = computed(() => {
246
249
  const allowedFormat = props.allowedFileTypes.join(", ");
247
250
 
248
- return `${props.config?.i18n?.canAttachFilesFormat || t("UInputFile.canAttachFilesFormat")} ${allowedFormat}`;
251
+ return `${currentLocale.value.canAttachFilesFormat} ${allowedFormat}`;
249
252
  });
250
253
 
251
254
  const descriptionText = computed(() => {
252
- return `${props.config?.i18n?.selectOrDragImage || t("UInputFile.selectOrDragImage")} ${allowedFilesForUpload.value}`;
255
+ return `${currentLocale.value.selectOrDragImage} ${allowedFilesForUpload.value}`;
253
256
  });
254
257
 
255
258
  const componentSize = computed(() => {
@@ -365,10 +368,8 @@ function onChangeError() {
365
368
  function onChangeErrorFilesTypes() {
366
369
  if (errorFilesTypes.value.length) {
367
370
  const error = errorFilesTypes.value.join(", ");
368
- const cannotAttachFilesStart =
369
- props.config?.i18n?.cannotAttachFilesStart || t("UInputFile.cannotAttachFilesStart");
370
- const cannotAttachFilesEnd =
371
- props.config?.i18n?.cannotAttachFilesEnd || t("UInputFile.cannotAttachFilesEnd");
371
+ const cannotAttachFilesStart = currentLocale.value.cannotAttachFilesStart;
372
+ const cannotAttachFilesEnd = currentLocale.value.cannotAttachFilesEnd;
372
373
 
373
374
  errorMessage.value = `${cannotAttachFilesStart} ${error} ${cannotAttachFilesEnd}`;
374
375
  }
@@ -151,7 +151,7 @@
151
151
  v-bind="caretClearTextAttrs"
152
152
  @mousedown.prevent.capture="removeElement(localValue)"
153
153
  @click.prevent.capture
154
- v-text="props.config?.i18n?.clear || t('USelect.clear')"
154
+ v-text="currentLocale.clear"
155
155
  />
156
156
  </div>
157
157
 
@@ -189,15 +189,11 @@
189
189
  </template>
190
190
 
191
191
  <template #empty="{ emptyStyles }">
192
- <span
193
- v-show="isEmpty"
194
- :class="emptyStyles"
195
- v-text="props.config?.i18n?.listIsEmpty || t('USelect.listIsEmpty')"
196
- />
192
+ <span v-show="isEmpty" :class="emptyStyles" v-text="currentLocale.listIsEmpty" />
197
193
  <span
198
194
  v-show="options.length === 0 && !search && !isEmpty"
199
195
  :class="emptyStyles"
200
- v-text="props.config?.i18n?.noDataToShow || t('USelect.noDataToShow')"
196
+ v-text="currentLocale.noDataToShow"
201
197
  />
202
198
  </template>
203
199
  </UDropdownList>
@@ -207,7 +203,7 @@
207
203
 
208
204
  <script setup>
209
205
  import { ref, computed, nextTick, watch, useSlots, onMounted } from "vue";
210
- import { debounce } from "lodash-es";
206
+ import { debounce, merge } from "lodash-es";
211
207
 
212
208
  import UIcon from "../ui.image-icon";
213
209
  import ULabel from "../ui.form-label";
@@ -444,7 +440,7 @@ const emit = defineEmits([
444
440
  ]);
445
441
 
446
442
  const slots = useSlots();
447
- const { t } = useLocale();
443
+ const { tm } = useLocale();
448
444
 
449
445
  const isOpen = ref(false);
450
446
  const preferredOpenDirection = ref(DIRECTION.bottom);
@@ -492,8 +488,10 @@ const {
492
488
  dropdownListAttrs,
493
489
  } = useAttrs(props, { isTop, isOpen, selectedLabel });
494
490
 
491
+ const currentLocale = computed(() => merge(tm("USelect"), props.config.i18n));
492
+
495
493
  const inputPlaceholder = computed(() => {
496
- const message = props.config?.i18n?.value.addMore || t("USelect.addMore");
494
+ const message = currentLocale.value.addMore;
497
495
 
498
496
  return props.multiple && localValue.value.length ? message : props.placeholder;
499
497
  });
@@ -38,6 +38,7 @@
38
38
 
39
39
  <script setup>
40
40
  import { computed } from "vue";
41
+ import { merge } from "lodash-es";
41
42
 
42
43
  import UIcon from "../ui.image-icon";
43
44
  import ULabel from "../ui.form-label";
@@ -154,7 +155,9 @@ const props = defineProps({
154
155
 
155
156
  const emit = defineEmits(["update:modelValue"]);
156
157
 
157
- const { t } = useLocale();
158
+ const { tm } = useLocale();
159
+
160
+ const currentLocale = computed(() => merge(tm("USwitch"), props.config.i18n));
158
161
 
159
162
  const checkedValue = computed({
160
163
  get: () => props.modelValue,
@@ -165,9 +168,7 @@ const { config, iconAttrs, labelAttrs, inputAttrs, wrapperAttrs, circleAttrs, to
165
168
  useAttrs(props, { checked: checkedValue });
166
169
 
167
170
  const switchLabel = computed(() => {
168
- return checkedValue.value
169
- ? props.config?.i18n?.active || t("USwitch.active")
170
- : props.config?.i18n?.inactive || t("USwitch.inactive");
171
+ return checkedValue.value ? currentLocale.value.active : currentLocale.value.inactive;
171
172
  });
172
173
 
173
174
  const iconSize = computed(() => {
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.49",
4
+ "version": "0.0.50",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",