its_ui_vite 1.1.9 → 1.1.10

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "its_ui_vite",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "main": "./src/libIndex.js",
5
5
  "module": "./src/libIndex.js",
6
6
  "files": [
@@ -29,7 +29,6 @@
29
29
  <CScroll2
30
30
  ref="list"
31
31
  :style="`--transition: ${transition}ms; --width: ${width}; --list-indent-y: ${listIndentY}px`"
32
- :scrollY="scrollY"
33
32
  :class="[classes.list, listPosition, {open: isOpen}]"
34
33
  >
35
34
  <button
@@ -58,11 +57,13 @@
58
57
  :is="isMultiple ? CCheckbox : 'div'"
59
58
  v-bind.props="getCheckboxProp(item)"
60
59
  >
61
- <TextTooltip
62
- :text="item.text"
63
- :line-height="20"
64
- :max-text-line="2"
65
- />
60
+ <slot name="option" :item="item">
61
+ <TextTooltip
62
+ :text="item.text"
63
+ :line-height="20"
64
+ :max-text-line="2"
65
+ />
66
+ </slot>
66
67
  </component>
67
68
  </button>
68
69
  <div v-if="foundOptions.length < 1" :class="[classes.option, 'not-found']">
@@ -141,7 +142,6 @@ const transition = 200,
141
142
 
142
143
  let findValue = ref(''),
143
144
  isOpen = ref(props.isOpen || false),
144
- scrollY = ref<number>(0),
145
145
  root = ref(),
146
146
  list = ref(),
147
147
  activePlaceholder = ref(props.placeholder),
@@ -225,9 +225,16 @@ const iconInfo = {
225
225
 
226
226
  const foundOptions = computed(() => {
227
227
  const reg = new RegExp(findValue.value.replace(/\W/g, '\\$&'), 'i')
228
- scrollY.value = Math.random();
229
228
 
230
- return props.options.filter(({text}) => text && reg.test(text))
229
+ return props.options.filter(({ text }) => text && reg.test(text))
230
+ .map((option) => {
231
+ const isActive = !!([...activeOptions.value, ...props.modelValue].find((item) => [item.value, item].includes(option.value)));
232
+
233
+ return {
234
+ ...option,
235
+ active: isActive,
236
+ }
237
+ })
231
238
  })
232
239
 
233
240
  watch(() => props.modelValue, (options: TOption[]) => {
@@ -946,7 +946,12 @@
946
946
  v-model="VModelOption"
947
947
  :autocomplete="true"
948
948
  @change_cselect="(evt) => log(['CSelect default', evt])"
949
- />
949
+ >
950
+ <template #option="{ item }">
951
+ <span class="option-text">{{ item.text }}</span>
952
+ <span v-if="item.active" class="option-badge">(активен)</span>
953
+ </template>
954
+ </CSelect>
950
955
  </div>
951
956
  </div>
952
957
  <!-- ./col -->
@@ -1,54 +1,63 @@
1
+ import { ref } from 'vue';
1
2
  import CIcon from '../components/CIcons/CIcon.vue';
2
3
  import { iconContent } from '../assets/icon/icons-manifest';
3
4
 
5
+ const iconNames = Object.keys(iconContent);
6
+
4
7
  export default {
5
8
  title: 'Components/CIcon',
6
9
  component: CIcon,
7
10
  tags: ['autodocs'],
8
11
  argTypes: {
9
- size: { control: 'number' },
12
+ size: { control: { type: 'range', min: 12, max: 96, step: 4 } },
10
13
  },
11
14
  args: {
12
15
  size: 24,
13
- name: { 'Home': true },
14
16
  },
15
17
  };
16
18
 
17
- export const Default = {
18
- render: (args) => ({
19
- components: { CIcon },
20
- setup() { return { args }; },
21
- template: `<CIcon v-bind="args" />`,
22
- }),
23
- };
24
-
25
- export const LargeIcon = {
26
- args: { size: 48, name: { 'Star': true } },
19
+ export const Gallery = {
27
20
  render: (args) => ({
28
- components: { CIcon },
29
- setup() { return { args }; },
30
- template: `<CIcon v-bind="args" />`,
31
- }),
32
- };
33
-
34
- export const IconGallery = {
35
- render: () => ({
36
21
  components: { CIcon },
37
22
  setup() {
38
- const icons = Object.keys(iconContent);
39
- return { icons };
23
+ const icons = iconNames;
24
+ const size = args.size;
25
+ return { icons, size };
40
26
  },
41
27
  template: `
42
- <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px;">
28
+ <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px;">
43
29
  <div
44
30
  v-for="icon in icons"
45
31
  :key="icon"
46
32
  style="display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border: 1px solid #333; border-radius: 8px;"
47
33
  >
48
- <CIcon :name="{[icon]: true}" :size="24" />
34
+ <CIcon :name="{[icon]: true}" :size="size" />
49
35
  <span style="color: #fff; font-size: 10px; text-align: center; word-break: break-all;">{{ icon }}</span>
50
36
  </div>
51
37
  </div>
52
38
  `,
53
39
  }),
54
40
  };
41
+
42
+ export const SingleIcon = {
43
+ argTypes: {
44
+ icon: {
45
+ control: 'select',
46
+ options: iconNames,
47
+ },
48
+ },
49
+ args: {
50
+ icon: iconNames[0],
51
+ size: 48,
52
+ },
53
+ render: (args) => ({
54
+ components: { CIcon },
55
+ setup() { return { args }; },
56
+ template: `
57
+ <div style="display: flex; flex-direction: column; align-items: center; gap: 12px;">
58
+ <CIcon :name="{[args.icon]: true}" :size="args.size" />
59
+ <span style="color: #fff;">{{ args.icon }}</span>
60
+ </div>
61
+ `,
62
+ }),
63
+ };