hoci 0.0.2 → 0.0.3

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/dist/index.cjs CHANGED
@@ -147,6 +147,9 @@ const selectionListProps = defineHookProps({
147
147
  type: [Boolean, Number],
148
148
  default: () => false
149
149
  },
150
+ clearable: {
151
+ type: Boolean
152
+ },
150
153
  defaultValue: {
151
154
  type: valuePropType
152
155
  },
@@ -189,12 +192,10 @@ const useSelectionList = defineHookComponent({
189
192
  },
190
193
  set(val) {
191
194
  emit("update:modelValue", val);
195
+ emit("change", val);
192
196
  }
193
197
  });
194
198
  core.syncRef(currentValue, modelValue, { immediate: true, deep: true });
195
- vue.watch(currentValue, (val) => {
196
- emit("change", val);
197
- }, { deep: true });
198
199
  vue.provide(
199
200
  ActiveClassSymbol,
200
201
  vue.computed(() => props.activeClass)
@@ -214,7 +215,7 @@ const useSelectionList = defineHookComponent({
214
215
  }
215
216
  function changeActive(option) {
216
217
  if (isActive(option)) {
217
- if (props.multiple) {
218
+ if (props.multiple || props.clearable) {
218
219
  actives.splice(actives.indexOf(option), 1);
219
220
  }
220
221
  } else {
package/dist/index.d.ts CHANGED
@@ -133,10 +133,16 @@ declare const selectionListProps: {
133
133
  modelValue: {
134
134
  type: PropType<any>;
135
135
  };
136
+ /**
137
+ * 选中时的 class
138
+ */
136
139
  activeClass: {
137
140
  type: PropType<string | string[]>;
138
141
  default: string;
139
142
  };
143
+ /**
144
+ * 每个选项的 class
145
+ */
140
146
  itemClass: {
141
147
  type: PropType<string | string[]>;
142
148
  default: string;
@@ -155,6 +161,12 @@ declare const selectionListProps: {
155
161
  type: (BooleanConstructor | NumberConstructor)[];
156
162
  default: () => false;
157
163
  };
164
+ /**
165
+ * 可清除
166
+ */
167
+ clearable: {
168
+ type: BooleanConstructor;
169
+ };
158
170
  defaultValue: {
159
171
  type: PropType<any>;
160
172
  };
@@ -186,10 +198,16 @@ declare const useSelectionList: HookComponent<{
186
198
  modelValue: {
187
199
  type: PropType<any>;
188
200
  };
201
+ /**
202
+ * 选中时的 class
203
+ */
189
204
  activeClass: {
190
205
  type: PropType<string | string[]>;
191
206
  default: string;
192
207
  };
208
+ /**
209
+ * 每个选项的 class
210
+ */
193
211
  itemClass: {
194
212
  type: PropType<string | string[]>;
195
213
  default: string;
@@ -208,6 +226,12 @@ declare const useSelectionList: HookComponent<{
208
226
  type: (BooleanConstructor | NumberConstructor)[];
209
227
  default: () => false;
210
228
  };
229
+ /**
230
+ * 可清除
231
+ */
232
+ clearable: {
233
+ type: BooleanConstructor;
234
+ };
211
235
  defaultValue: {
212
236
  type: PropType<any>;
213
237
  };
@@ -223,10 +247,16 @@ declare const useSelectionList: HookComponent<{
223
247
  modelValue: {
224
248
  type: PropType<any>;
225
249
  };
250
+ /**
251
+ * 选中时的 class
252
+ */
226
253
  activeClass: {
227
254
  type: PropType<string | string[]>;
228
255
  default: string;
229
256
  };
257
+ /**
258
+ * 每个选项的 class
259
+ */
230
260
  itemClass: {
231
261
  type: PropType<string | string[]>;
232
262
  default: string;
@@ -245,6 +275,12 @@ declare const useSelectionList: HookComponent<{
245
275
  type: (BooleanConstructor | NumberConstructor)[];
246
276
  default: () => false;
247
277
  };
278
+ /**
279
+ * 可清除
280
+ */
281
+ clearable: {
282
+ type: BooleanConstructor;
283
+ };
248
284
  defaultValue: {
249
285
  type: PropType<any>;
250
286
  };
@@ -261,10 +297,16 @@ declare const HiSelection: vue.DefineComponent<{
261
297
  modelValue: {
262
298
  type: PropType<any>;
263
299
  };
300
+ /**
301
+ * 选中时的 class
302
+ */
264
303
  activeClass: {
265
304
  type: PropType<string | string[]>;
266
305
  default: string;
267
306
  };
307
+ /**
308
+ * 每个选项的 class
309
+ */
268
310
  itemClass: {
269
311
  type: PropType<string | string[]>;
270
312
  default: string;
@@ -283,6 +325,12 @@ declare const HiSelection: vue.DefineComponent<{
283
325
  type: (BooleanConstructor | NumberConstructor)[];
284
326
  default: () => false;
285
327
  };
328
+ /**
329
+ * 可清除
330
+ */
331
+ clearable: {
332
+ type: BooleanConstructor;
333
+ };
286
334
  defaultValue: {
287
335
  type: PropType<any>;
288
336
  };
@@ -300,10 +348,16 @@ declare const HiSelection: vue.DefineComponent<{
300
348
  modelValue: {
301
349
  type: PropType<any>;
302
350
  };
351
+ /**
352
+ * 选中时的 class
353
+ */
303
354
  activeClass: {
304
355
  type: PropType<string | string[]>;
305
356
  default: string;
306
357
  };
358
+ /**
359
+ * 每个选项的 class
360
+ */
307
361
  itemClass: {
308
362
  type: PropType<string | string[]>;
309
363
  default: string;
@@ -322,6 +376,12 @@ declare const HiSelection: vue.DefineComponent<{
322
376
  type: (BooleanConstructor | NumberConstructor)[];
323
377
  default: () => false;
324
378
  };
379
+ /**
380
+ * 可清除
381
+ */
382
+ clearable: {
383
+ type: BooleanConstructor;
384
+ };
325
385
  defaultValue: {
326
386
  type: PropType<any>;
327
387
  };
@@ -341,6 +401,7 @@ declare const HiSelection: vue.DefineComponent<{
341
401
  tag: string;
342
402
  activeClass: string | string[];
343
403
  unactiveClass: string | string[];
404
+ clearable: boolean;
344
405
  }>;
345
406
 
346
407
  declare const switchProps: {
package/dist/index.mjs CHANGED
@@ -145,6 +145,9 @@ const selectionListProps = defineHookProps({
145
145
  type: [Boolean, Number],
146
146
  default: () => false
147
147
  },
148
+ clearable: {
149
+ type: Boolean
150
+ },
148
151
  defaultValue: {
149
152
  type: valuePropType
150
153
  },
@@ -187,12 +190,10 @@ const useSelectionList = defineHookComponent({
187
190
  },
188
191
  set(val) {
189
192
  emit("update:modelValue", val);
193
+ emit("change", val);
190
194
  }
191
195
  });
192
196
  syncRef(currentValue, modelValue, { immediate: true, deep: true });
193
- watch(currentValue, (val) => {
194
- emit("change", val);
195
- }, { deep: true });
196
197
  provide(
197
198
  ActiveClassSymbol,
198
199
  computed(() => props.activeClass)
@@ -212,7 +213,7 @@ const useSelectionList = defineHookComponent({
212
213
  }
213
214
  function changeActive(option) {
214
215
  if (isActive(option)) {
215
- if (props.multiple) {
216
+ if (props.multiple || props.clearable) {
216
217
  actives.splice(actives.indexOf(option), 1);
217
218
  }
218
219
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hoci",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",