@antify/ui 4.1.11 → 4.1.12

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.
@@ -125,6 +125,8 @@ const inputClasses = computed(() => {
125
125
  'rounded-tr-none rounded-br-none': props.nullable && _modelValue.value !== null,
126
126
  // Disabled
127
127
  'opacity-50 cursor-not-allowed': props.disabled,
128
+ // Option deleted
129
+ 'line-through': selectedOption.value?.isDeleted,
128
130
  };
129
131
  });
130
132
  const placeholderClasses = computed(() => {
@@ -276,7 +278,7 @@ function onClickRemoveButton() {
276
278
  v-model="_modelValue"
277
279
  v-model:open="isOpen"
278
280
  v-model:focused="dropDownFocused"
279
- :options="options"
281
+ :options="(options || []).filter(option => !option.isDeleted)"
280
282
  :size="size"
281
283
  :state="state"
282
284
  :close-on-enter="true"
@@ -143,10 +143,10 @@ const filteredOptions = computed(() => {
143
143
  return props.options.filter(option => {
144
144
  // Remove all elements that are in modelValue from the filtered options
145
145
  if (_modelValue.value && !props.allowDuplicates) {
146
- return !_modelValue.value?.includes(option.value);
146
+ return !_modelValue.value?.includes(option.value) && !option.isDeleted;
147
147
  }
148
148
 
149
- return option.label.toLowerCase().includes(tagInput.value.toLowerCase());
149
+ return option.label.toLowerCase().includes(tagInput.value.toLowerCase()) && !option.isDeleted;
150
150
  });
151
151
  });
152
152
 
@@ -295,7 +295,13 @@ onMounted(() => {
295
295
  :dismiss="!readonly"
296
296
  @close="removeTag(tag)"
297
297
  >
298
- {{ options.find((option: SelectOption) => option.value === tag)?.label }}
298
+ <span
299
+ :class="{
300
+ 'line-through': options.find((option: SelectOption) => option.value === tag)?.isDeleted
301
+ }"
302
+ >
303
+ {{ options.find((option: SelectOption) => option.value === tag)?.label }}
304
+ </span>
299
305
  </AntTag>
300
306
  </div>
301
307
 
@@ -60,14 +60,6 @@ const {
60
60
  whileElementsMounted: autoUpdate,
61
61
  middleware: [
62
62
  offset(8),
63
- autoPlacement({
64
- allowedPlacements: [
65
- 'top-start',
66
- 'top-end',
67
- 'bottom-start',
68
- 'bottom-end',
69
- ],
70
- }),
71
63
  flip({
72
64
  fallbackPlacements: [
73
65
  'top-start',
@@ -5,6 +5,7 @@ export default meta;
5
5
  type Story = StoryObj<typeof AntSelect>;
6
6
  export declare const Docs: Story;
7
7
  export declare const WithSlots: Story;
8
+ export declare const withDeleted: Story;
8
9
  export declare const manyOptions: Story;
9
10
  export declare const longOptions: Story;
10
11
  export declare const nullable: Story;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.withPlaceholder = exports.summary = exports.skeleton = exports.nullable = exports.manyOptions = exports.longOptions = exports.grouped = exports.ellipsisText = exports.disabled = exports.default = exports.WithSlots = exports.Docs = void 0;
6
+ exports.withPlaceholder = exports.withDeleted = exports.summary = exports.skeleton = exports.nullable = exports.manyOptions = exports.longOptions = exports.grouped = exports.ellipsisText = exports.disabled = exports.default = exports.WithSlots = exports.Docs = void 0;
7
7
  var _Size = require("../../../enums/Size.enum");
8
8
  var _AntSelect = _interopRequireDefault(require("../AntSelect.vue"));
9
9
  var _AntIcon = _interopRequireDefault(require("../../AntIcon.vue"));
@@ -103,6 +103,20 @@ const options = [{
103
103
  label: "Option 12",
104
104
  value: "12"
105
105
  }];
106
+ const withDeletedSelectOptions = [{
107
+ label: "Dog",
108
+ value: "dog"
109
+ }, {
110
+ label: "Cat",
111
+ value: "cat"
112
+ }, {
113
+ label: "Bird",
114
+ value: "bird"
115
+ }, {
116
+ label: "Lion",
117
+ value: "lion",
118
+ isDeleted: true
119
+ }];
106
120
  const manySelectOptions = [...Array(24).keys()].map(key => ({
107
121
  label: `Option ${Number(key) + 1}`,
108
122
  value: Number(key) + 1
@@ -216,6 +230,14 @@ const WithSlots = exports.WithSlots = {
216
230
  description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
217
231
  }
218
232
  };
233
+ const withDeleted = exports.withDeleted = {
234
+ render: Docs.render,
235
+ args: {
236
+ ...Docs.args,
237
+ modelValue: "lion",
238
+ options: withDeletedSelectOptions
239
+ }
240
+ };
219
241
  const manyOptions = exports.manyOptions = {
220
242
  render: Docs.render,
221
243
  args: {
@@ -119,6 +119,25 @@ const options = [
119
119
  value: "12"
120
120
  }
121
121
  ];
122
+ const withDeletedSelectOptions = [
123
+ {
124
+ label: "Dog",
125
+ value: "dog"
126
+ },
127
+ {
128
+ label: "Cat",
129
+ value: "cat"
130
+ },
131
+ {
132
+ label: "Bird",
133
+ value: "bird"
134
+ },
135
+ {
136
+ label: "Lion",
137
+ value: "lion",
138
+ isDeleted: true
139
+ }
140
+ ];
122
141
  const manySelectOptions = [
123
142
  ...Array(24).keys()
124
143
  ].map((key) => ({
@@ -241,6 +260,14 @@ export const WithSlots = {
241
260
  description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
242
261
  }
243
262
  };
263
+ export const withDeleted = {
264
+ render: Docs.render,
265
+ args: {
266
+ ...Docs.args,
267
+ modelValue: "lion",
268
+ options: withDeletedSelectOptions
269
+ }
270
+ };
244
271
  export const manyOptions = {
245
272
  render: Docs.render,
246
273
  args: {
@@ -4,5 +4,6 @@ declare const meta: Meta<typeof AntTagInput>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntTagInput>;
6
6
  export declare const Docs: Story;
7
+ export declare const withDeleted: Story;
7
8
  export declare const AllowCreate: Story;
8
9
  export declare const summary: Story;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.summary = exports.default = exports.Docs = exports.AllowCreate = void 0;
6
+ exports.withDeleted = exports.summary = exports.default = exports.Docs = exports.AllowCreate = void 0;
7
7
  var _AntTagInput = _interopRequireDefault(require("../AntTagInput.vue"));
8
8
  var _vue = require("vue");
9
9
  var _enums = require("../../../enums");
@@ -19,7 +19,7 @@ const meta = {
19
19
  control: "text",
20
20
  table: {
21
21
  type: {
22
- summary: "string|null"
22
+ summary: "string[]|null"
23
23
  }
24
24
  }
25
25
  },
@@ -73,10 +73,12 @@ const options = [{
73
73
  value: "2"
74
74
  }, {
75
75
  label: "Dog",
76
- value: "3"
76
+ value: "3",
77
+ isDeleted: true
77
78
  }, {
78
79
  label: "Chicken",
79
- value: "4"
80
+ value: "4",
81
+ isDeleted: true
80
82
  }];
81
83
  const Docs = exports.Docs = {
82
84
  render: args => ({
@@ -100,6 +102,28 @@ const Docs = exports.Docs = {
100
102
  options
101
103
  }
102
104
  };
105
+ const withDeleted = exports.withDeleted = {
106
+ render: args => ({
107
+ components: {
108
+ AntTagInput: _AntTagInput.default
109
+ },
110
+ setup() {
111
+ const value = (0, _vue.ref)(["3", "4"]);
112
+ return {
113
+ args,
114
+ value
115
+ };
116
+ },
117
+ template: `
118
+ <div style="width: 360px">
119
+ <AntTagInput v-model="value" v-bind="args"/>
120
+ </div>
121
+ `
122
+ }),
123
+ args: {
124
+ options
125
+ }
126
+ };
103
127
  const AllowCreate = exports.AllowCreate = {
104
128
  render: Docs.render,
105
129
  args: {
@@ -18,7 +18,7 @@ const meta = {
18
18
  control: "text",
19
19
  table: {
20
20
  type: {
21
- summary: "string|null"
21
+ summary: "string[]|null"
22
22
  }
23
23
  }
24
24
  },
@@ -75,11 +75,13 @@ const options = [
75
75
  },
76
76
  {
77
77
  label: "Dog",
78
- value: "3"
78
+ value: "3",
79
+ isDeleted: true
79
80
  },
80
81
  {
81
82
  label: "Chicken",
82
- value: "4"
83
+ value: "4",
84
+ isDeleted: true
83
85
  }
84
86
  ];
85
87
  export const Docs = {
@@ -104,6 +106,31 @@ export const Docs = {
104
106
  options
105
107
  }
106
108
  };
109
+ export const withDeleted = {
110
+ render: (args) => ({
111
+ components: {
112
+ AntTagInput
113
+ },
114
+ setup() {
115
+ const value = ref([
116
+ "3",
117
+ "4"
118
+ ]);
119
+ return {
120
+ args,
121
+ value
122
+ };
123
+ },
124
+ template: `
125
+ <div style="width: 360px">
126
+ <AntTagInput v-model="value" v-bind="args"/>
127
+ </div>
128
+ `
129
+ }),
130
+ args: {
131
+ options
132
+ }
133
+ };
107
134
  export const AllowCreate = {
108
135
  render: Docs.render,
109
136
  args: {
@@ -2,4 +2,5 @@ export type SelectOption = {
2
2
  label: string;
3
3
  value?: string | number;
4
4
  isGroupLabel?: boolean;
5
+ isDeleted?: boolean;
5
6
  } & Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antify/ui",
3
- "version": "4.1.11",
3
+ "version": "4.1.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {