eco-vue-js 0.10.6 → 0.10.7

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.
@@ -19,7 +19,7 @@ declare const _default: <Data extends DefaultData, QueryParams, Fields extends L
19
19
  selectionTitle: string;
20
20
  bulk?: BulkComponent<QueryParams>[];
21
21
  bulkMore?: BulkComponent<QueryParams>[];
22
- menu: MenuComponent<Data>[];
22
+ menu?: MenuComponent<Data>[];
23
23
  readonlyGetter?: (item: Data) => boolean;
24
24
  cardClass?: string;
25
25
  cardWrapperClass?: string;
@@ -34,7 +34,6 @@ declare const _default: <Data extends DefaultData, QueryParams, Fields extends L
34
34
  noOrdering?: boolean;
35
35
  formNameGetter?: (data: Data) => string | undefined;
36
36
  groupBy?: (a: Data, b: Data) => boolean;
37
- hideMore?: boolean;
38
37
  cardColumns: CardColumns;
39
38
  cardAreas: CardAreas<Fields, CardColumns["length"]>;
40
39
  cardTo?: (item: Data) => LinkProps["to"];
@@ -1 +1 @@
1
- {"version":3,"file":"WList.vue.d.ts","sourceRoot":"","sources":["../../../src/components/List/WList.vue"],"names":[],"mappings":"AAiXA,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAC,MAAM,SAAS,CAAA;AACzH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AAWzC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAA;yBAYrB,IAAI,SAAS,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,WAAW,SAAS,SAAS,OAAO,EAAE,eAC9H,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAA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;mBACxB,aAAa,CAAC,WAAW,CAAC,EAAE;eAChC,aAAa,CAAC,IAAI,CAAC,EAAE;yBACX,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO;oBAC5B,MAAM;2BACC,MAAM;6BACJ,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM;oBACvD,OAAO;mBACR,MAAM;0BACC,cAAc,CAAC,MAAM,CAAC;sBAC1B,QAAQ;mBACX,OAAO;sBACJ,OAAO;mBACV,OAAO;qBACL,OAAO;yBACH,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,GAAG,SAAS;kBACzC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,KAAK,OAAO;qBAC1B,WAAW;mBACb,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;iBAC1C,CAAC,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC;KAsoB6C,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;;YA9De,GAAG;;;;;YACH,GAAG;;cAtkBzB,cAAc,SAAS,QAAQ,KAAG,IAAI;;;;YAwoBA,OAAO,CAAC,OAAO,WAAW,CAAC;;AA/qBvE,wBA+qB4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, computed, toRef, createElementBlock, openBlock, normalizeClass, unref, createVNode, normalizeStyle, withCtx, renderSlot, createCommentVNode, createSlots, Fragment, renderList, createBlock, resolveDynamicComponent, createElementVNode, isRef } from 'vue';
1
+ import { defineComponent, ref, computed, toRef, createElementBlock, openBlock, normalizeClass, unref, createVNode, normalizeStyle, withCtx, renderSlot, createCommentVNode, createSlots, createBlock, resolveDynamicComponent, Fragment, renderList, createElementVNode, isRef } from 'vue';
2
2
  import _sfc_main$4 from '../Button/WButtonSelection.vue.js';
3
3
  import _sfc_main$1 from '../InfiniteList/WInfiniteList.vue.js';
4
4
  import { useIsMobile } from '../../utils/mobile.js';
@@ -43,7 +43,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43
43
  noOrdering: { type: Boolean },
44
44
  formNameGetter: { type: Function },
45
45
  groupBy: { type: Function },
46
- hideMore: { type: Boolean },
47
46
  cardColumns: {},
48
47
  cardAreas: {},
49
48
  cardTo: { type: Function }
@@ -75,6 +74,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
75
74
  });
76
75
  const allowSelect = computed(() => props.bulk !== void 0);
77
76
  const allowOpen = computed(() => props.expansion !== void 0);
77
+ const disableSelect = computed(() => !allowSelect.value);
78
78
  const {
79
79
  allowSelectHover,
80
80
  selectionCount,
@@ -85,7 +85,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
85
85
  resetSelection,
86
86
  selectAll,
87
87
  getQueryParams
88
- } = useSelected(toRef(props, "count"));
88
+ } = useSelected(toRef(props, "count"), disableSelect);
89
89
  const ordering = computed(() => {
90
90
  if (props.queryParams instanceof Object && "ordering" in props.queryParams && typeof props.queryParams.ordering === "string") {
91
91
  return parseOrdering(props.queryParams.ordering);
@@ -139,18 +139,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
139
139
  class: "z-[2]",
140
140
  "onClear:selection": unref(resetSelection)
141
141
  }, createSlots({
142
- default: withCtx(({ disableMessage, cssClass }) => [
143
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.bulk, (item, index) => {
144
- return openBlock(), createBlock(resolveDynamicComponent(item), {
145
- key: index,
146
- "selection-count": unref(selectionCount),
147
- "query-params-getter": getQueryParamsBulk,
148
- "disable-message": disableMessage,
149
- class: normalizeClass(cssClass),
150
- "onClear:selected": unref(resetSelection)
151
- }, null, 40, ["selection-count", "disable-message", "class", "onClear:selected"]);
152
- }), 128))
153
- ]),
154
142
  settings: withCtx(() => [
155
143
  createElementVNode("div", _hoisted_1, [
156
144
  !_ctx.noOrdering ? (openBlock(), createBlock(_sfc_main$5, {
@@ -175,7 +163,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
175
163
  ]),
176
164
  _: 2
177
165
  }, [
178
- _ctx.bulkMore ? {
166
+ _ctx.bulk ? {
167
+ name: "default",
168
+ fn: withCtx(({ disableMessage, cssClass }) => [
169
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.bulk, (item, index) => {
170
+ return openBlock(), createBlock(resolveDynamicComponent(item), {
171
+ key: index,
172
+ "selection-count": unref(selectionCount),
173
+ "query-params-getter": getQueryParamsBulk,
174
+ "disable-message": disableMessage,
175
+ class: normalizeClass(cssClass),
176
+ "onClear:selected": unref(resetSelection)
177
+ }, null, 40, ["selection-count", "disable-message", "class", "onClear:selected"]);
178
+ }), 128))
179
+ ]),
180
+ key: "0"
181
+ } : void 0,
182
+ _ctx.bulk && _ctx.bulkMore ? {
179
183
  name: "more",
180
184
  fn: withCtx((scope) => [
181
185
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.bulkMore, (item, index) => {
@@ -189,7 +193,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
189
193
  }, null, 40, ["selection-count", "disable-message", "class", "onClear:selected"]);
190
194
  }), 128))
191
195
  ]),
192
- key: "0"
196
+ key: "1"
193
197
  } : void 0
194
198
  ]), 1032, ["title", "disable-message", "selected-count", "onClear:selection"]),
195
199
  !unref(isGrid) ? (openBlock(), createBlock(_sfc_main$7, {
@@ -240,7 +244,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
240
244
  "has-border": _ctx.hasBorder,
241
245
  "allow-open": allowOpen.value && !skeleton,
242
246
  "align-top": _ctx.alignTop,
243
- "hide-more": _ctx.hideMore,
244
247
  "form-name": !skeleton ? _ctx.formNameGetter?.(item) : void 0,
245
248
  card: unref(isGrid),
246
249
  to: _ctx.cardTo?.(item),
@@ -281,25 +284,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
281
284
  _: 2
282
285
  }, 1032, ["fields", "item", "skeleton", "card"])
283
286
  ]),
284
- more: withCtx(() => [
285
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menu, (menuItem, menuIndex) => {
286
- return openBlock(), createBlock(resolveDynamicComponent(menuItem), {
287
- key: menuIndex,
288
- item,
289
- readonly: _ctx.readonly || (_ctx.readonlyGetter?.(item) ?? false),
290
- "update-item": setter,
291
- "delete-item": () => {
292
- setter();
293
- refetch();
294
- },
295
- "onUpdate:item": setter,
296
- "onDelete:item": ($event) => {
297
- setter();
298
- refetch();
299
- }
300
- }, null, 40, ["item", "readonly", "update-item", "delete-item", "onUpdate:item", "onDelete:item"]);
301
- }), 128))
302
- ]),
303
287
  _: 2
304
288
  }, [
305
289
  _ctx.expansion ? {
@@ -318,8 +302,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
318
302
  }, null, 40, ["item", "readonly", "skeleton", "card", "onUpdate:item", "onDelete:item"]))
319
303
  ]),
320
304
  key: "0"
305
+ } : void 0,
306
+ _ctx.menu ? {
307
+ name: "more",
308
+ fn: withCtx(() => [
309
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menu, (menuItem, menuIndex) => {
310
+ return openBlock(), createBlock(resolveDynamicComponent(menuItem), {
311
+ key: menuIndex,
312
+ item,
313
+ readonly: _ctx.readonly || (_ctx.readonlyGetter?.(item) ?? false),
314
+ "update-item": setter,
315
+ "delete-item": () => {
316
+ setter();
317
+ refetch();
318
+ },
319
+ "onUpdate:item": setter,
320
+ "onDelete:item": ($event) => {
321
+ setter();
322
+ refetch();
323
+ }
324
+ }, null, 40, ["item", "readonly", "update-item", "delete-item", "onUpdate:item", "onDelete:item"]);
325
+ }), 128))
326
+ ]),
327
+ key: "1"
321
328
  } : void 0
322
- ]), 1032, ["disabled", "disable-more", "mobile", "card-class", "card-wrapper-class", "has-border", "allow-open", "align-top", "hide-more", "form-name", "card", "to", "selected", "allow-select", "allow-select-hover", "onToggle:selected", "onHover:selected"])
329
+ ]), 1032, ["disabled", "disable-more", "mobile", "card-class", "card-wrapper-class", "has-border", "allow-open", "align-top", "form-name", "card", "to", "selected", "allow-select", "allow-select-hover", "onToggle:selected", "onHover:selected"])
323
330
  ]),
324
331
  _: 3
325
332
  }, 8, ["use-query-fn", "query-params", "query-options", "skeleton-length", "page-length", "count", "page-class", "style", "class"])
@@ -18,7 +18,6 @@ declare function __VLS_template(): {
18
18
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
19
19
  declare const __VLS_component: import('vue').DefineComponent<{
20
20
  disabled: boolean | undefined;
21
- hideMore: boolean | undefined;
22
21
  mobile: boolean | undefined;
23
22
  alignTop: boolean | undefined;
24
23
  hasBorder: boolean | undefined;
@@ -37,7 +36,6 @@ declare const __VLS_component: import('vue').DefineComponent<{
37
36
  "hover:selected": () => any;
38
37
  }, string, import('vue').PublicProps, Readonly<{
39
38
  disabled: boolean | undefined;
40
- hideMore: boolean | undefined;
41
39
  mobile: boolean | undefined;
42
40
  alignTop: boolean | undefined;
43
41
  hasBorder: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"WListCard.vue.d.ts","sourceRoot":"","sources":["../../../src/components/List/WListCard.vue"],"names":[],"mappings":"AA+OA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,eAAe,CAAA;AA+D5C,iBAAS,cAAc;;;;;;YAwZO,GAAG;sBACN,GAAG;sBACH,GAAG;2BACE,GAAG;;;;;WAUrB,OAAO,IAA6B;EAEjD;AA2BD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;cA/eT,OAAO,GAAG,SAAS;cACnB,OAAO,GAAG,SAAS;YACrB,OAAO,GAAG,SAAS;cACjB,OAAO,GAAG,SAAS;eAClB,OAAO,GAAG,SAAS;eACnB,MAAM,GAAG,SAAS;sBACX,MAAM,GAAG,SAAS;eACzB,OAAO,GAAG,SAAS;iBACjB,OAAO,GAAG,SAAS;cACtB,MAAM,GAAG,SAAS;UACtB,OAAO;QACT,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS;cAErB,OAAO;iBACJ,OAAO;sBACF,OAAO;;;;;cAff,OAAO,GAAG,SAAS;cACnB,OAAO,GAAG,SAAS;YACrB,OAAO,GAAG,SAAS;cACjB,OAAO,GAAG,SAAS;eAClB,OAAO,GAAG,SAAS;eACnB,MAAM,GAAG,SAAS;sBACX,MAAM,GAAG,SAAS;eACzB,OAAO,GAAG,SAAS;iBACjB,OAAO,GAAG,SAAS;cACtB,MAAM,GAAG,SAAS;UACtB,OAAO;QACT,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS;cAErB,OAAO;iBACJ,OAAO;sBACF,OAAO;;;;kFA0ezB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"WListCard.vue.d.ts","sourceRoot":"","sources":["../../../src/components/List/WListCard.vue"],"names":[],"mappings":"AA8OA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,eAAe,CAAA;AA8D5C,iBAAS,cAAc;;;;;;YAwZO,GAAG;sBACN,GAAG;sBACH,GAAG;2BACE,GAAG;;;;;WAUrB,OAAO,IAA6B;EAEjD;AA2BD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;cA9eT,OAAO,GAAG,SAAS;YACrB,OAAO,GAAG,SAAS;cACjB,OAAO,GAAG,SAAS;eAClB,OAAO,GAAG,SAAS;eACnB,MAAM,GAAG,SAAS;sBACX,MAAM,GAAG,SAAS;eACzB,OAAO,GAAG,SAAS;iBACjB,OAAO,GAAG,SAAS;cACtB,MAAM,GAAG,SAAS;UACtB,OAAO;QACT,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS;cAErB,OAAO;iBACJ,OAAO;sBACF,OAAO;;;;;cAdf,OAAO,GAAG,SAAS;YACrB,OAAO,GAAG,SAAS;cACjB,OAAO,GAAG,SAAS;eAClB,OAAO,GAAG,SAAS;eACnB,MAAM,GAAG,SAAS;sBACX,MAAM,GAAG,SAAS;eACzB,OAAO,GAAG,SAAS;iBACjB,OAAO,GAAG,SAAS;cACtB,MAAM,GAAG,SAAS;UACtB,OAAO;QACT,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS;cAErB,OAAO;iBACJ,OAAO;sBACF,OAAO;;;;kFA0ezB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -29,7 +29,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29
29
  __name: "WListCard",
30
30
  props: {
31
31
  disabled: { type: Boolean },
32
- hideMore: { type: Boolean },
33
32
  mobile: { type: Boolean },
34
33
  alignTop: { type: Boolean },
35
34
  hasBorder: { type: Boolean },
@@ -137,7 +136,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
137
136
  _ctx.allowSelectHover ? { tag: "button", card: _ctx.card, onClick: () => _ctx.$emit("toggle:selected") } : _ctx.to ? { tag: markRaw(unref(RouterLink)), card: _ctx.card, class: "z-[-1]", props: { to: _ctx.to } } : { tag: "button", card: _ctx.card, class: "z-[-1]", onClick: toggle }
138
137
  )), null, 16)) : createCommentVNode("", true),
139
138
  _ctx.selected ? (openBlock(), createElementBlock("div", _hoisted_3)) : createCommentVNode("", true),
140
- _ctx.card ? (openBlock(), createBlock(_sfc_main$4, {
139
+ _ctx.card && _ctx.$slots.more ? (openBlock(), createBlock(_sfc_main$4, {
141
140
  key: 3,
142
141
  class: "-mr-4 flex items-center px-4",
143
142
  disabled: _ctx.disabled || _ctx.disableMore,
@@ -160,8 +159,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
160
159
  !_ctx.card ? (openBlock(), createElementBlock("div", {
161
160
  key: 1,
162
161
  class: normalizeClass(["right-inner bg-default dark:bg-default-dark sticky z-[1]", {
163
- "width-14": !_ctx.hideMore,
164
- "width-4": _ctx.hideMore
162
+ "width-14": _ctx.$slots.more,
163
+ "width-4": !_ctx.$slots.more
165
164
  }])
166
165
  }, [
167
166
  _cache[4] || (_cache[4] = createElementVNode("div", { class: "bg-default dark:bg-default-dark absolute left-full top-0 z-[-1] h-full w-[calc(var(--actions-bar-width)+var(--inner-margin))]" }, null, -1)),
@@ -175,7 +174,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
175
174
  "w-ripple-has-only w-ripple-hover w-ripple-opacity-[0.04]": isActionShown.value
176
175
  }])
177
176
  }, [
178
- !_ctx.hideMore ? (openBlock(), createBlock(_sfc_main$4, {
177
+ _ctx.$slots.more ? (openBlock(), createBlock(_sfc_main$4, {
179
178
  key: 0,
180
179
  class: normalizeClass(["flex h-full px-4", {
181
180
  "items-start pt-3": _ctx.alignTop,
@@ -1,4 +1,4 @@
1
- import { MaybeRef } from 'vue';
1
+ import { MaybeRef, Ref } from 'vue';
2
2
  export declare const getPosition: (page: number, index: number, pageLength: number) => number;
3
3
  export type Selection<Value> = {
4
4
  id__in?: Value[];
@@ -10,7 +10,7 @@ export type QueryParamsSelection = {
10
10
  id__in?: number[];
11
11
  id__not_in?: number[];
12
12
  };
13
- export declare const useSelected: <Value extends number>(count: MaybeRef<number | undefined>) => {
13
+ export declare const useSelected: <Value extends number>(count: MaybeRef<number | undefined>, disabled: Ref<boolean>) => {
14
14
  allowSelectHover: import('vue').ComputedRef<boolean>;
15
15
  selectionCount: import('vue').ComputedRef<number>;
16
16
  selectAllValue: import('vue').ComputedRef<boolean | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"useSelected.d.ts","sourceRoot":"","sources":["../../src/utils/useSelected.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,QAAQ,EAAmD,MAAM,KAAK,CAAA;AA4BnF,eAAO,MAAM,WAAW,SAAU,MAAM,SAAS,MAAM,cAAc,MAAM,KAAG,MAE7E,CAAA;AAED,MAAM,MAAM,SAAS,CAAC,KAAK,IAAI;IAC7B,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IAChB,UAAU,CAAC,EAAE,KAAK,EAAE,CAAA;IACpB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB,CAAA;AAID,eAAO,MAAM,WAAW,GAAI,KAAK,SAAS,MAAM,SACvC,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;wBA8ER,KAAK,YAAY,MAAM,KAAG,OAAO;8BAoB3B,MAAM;yBAMX,KAAK,YAAY,MAAM,KAAG,IAAI;;0BAlF/B,IAAI;0BAoKJ,oBAAoB,GAAG,SAAS;CAmC5D,CAAA"}
1
+ {"version":3,"file":"useSelected.d.ts","sourceRoot":"","sources":["../../src/utils/useSelected.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,QAAQ,EAAE,KAAK,GAAG,EAA+C,MAAM,KAAK,CAAA;AA4BzF,eAAO,MAAM,WAAW,SAAU,MAAM,SAAS,MAAM,cAAc,MAAM,KAAG,MAE7E,CAAA;AAED,MAAM,MAAM,SAAS,CAAC,KAAK,IAAI;IAC7B,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IAChB,UAAU,CAAC,EAAE,KAAK,EAAE,CAAA;IACpB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB,CAAA;AAID,eAAO,MAAM,WAAW,GAAI,KAAK,SAAS,MAAM,SAAS,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,YAAY,GAAG,CAAC,OAAO,CAAC;;;;wBA6EhF,KAAK,YAAY,MAAM,KAAG,OAAO;8BAoB3B,MAAM;yBAMX,KAAK,YAAY,MAAM,KAAG,IAAI;;0BAlF/B,IAAI;0BAoKJ,oBAAoB,GAAG,SAAS;CAwC5D,CAAA"}
@@ -1,4 +1,4 @@
1
- import { computed, ref, unref, onMounted, onBeforeUnmount } from 'vue';
1
+ import { computed, ref, unref, watch, onBeforeUnmount } from 'vue';
2
2
  import { useRoute, useRouter } from 'vue-router';
3
3
  import { isIdArray, isIndex } from './utils.js';
4
4
 
@@ -20,7 +20,7 @@ const getPosition = (page, index, pageLength) => {
20
20
  return (page - 1) * pageLength + index;
21
21
  };
22
22
  const isEmpty = (value) => Object.values(value).every((item) => !item);
23
- const useSelected = (count) => {
23
+ const useSelected = (count, disabled) => {
24
24
  const route = useRoute();
25
25
  const router = useRouter();
26
26
  const selection = computed(() => {
@@ -47,8 +47,8 @@ const useSelected = (count) => {
47
47
  const isShift = ref(false);
48
48
  const hoverValue = ref(null);
49
49
  const preselectValue = ref(null);
50
- const disabled = ref(false);
51
- const allowSelectHover = computed(() => isShift.value);
50
+ const unmounted = ref(false);
51
+ const allowSelectHover = computed(() => !disabled.value && isShift.value);
52
52
  const hoverAllowed = computed(() => allowSelectHover.value ? hoverValue.value : null);
53
53
  const upValue = computed(() => {
54
54
  if (selection.value.range) {
@@ -94,11 +94,11 @@ const useSelected = (count) => {
94
94
  return false;
95
95
  };
96
96
  const hoverSelected = (position) => {
97
- if (disabled.value) return;
97
+ if (unmounted.value || disabled.value) return;
98
98
  hoverValue.value = position;
99
99
  };
100
100
  const toggleSelected = (id, position) => {
101
- if (disabled.value) return;
101
+ if (unmounted.value || disabled.value) return;
102
102
  if (upValue.value !== null && downValue.value !== null) {
103
103
  let range;
104
104
  if (allowSelectHover.value) {
@@ -163,12 +163,17 @@ const useSelected = (count) => {
163
163
  if (selection.value.id__in) result.id__in = selection.value.id__in.slice();
164
164
  return result;
165
165
  };
166
- onMounted(() => {
167
- window.addEventListener("keydown", setIsSelecting);
168
- window.addEventListener("keyup", resetIsSelecting);
169
- });
166
+ watch(disabled, (value) => {
167
+ if (value) {
168
+ window.removeEventListener("keydown", setIsSelecting);
169
+ window.removeEventListener("keyup", resetIsSelecting);
170
+ } else {
171
+ window.addEventListener("keydown", setIsSelecting);
172
+ window.addEventListener("keyup", resetIsSelecting);
173
+ }
174
+ }, { immediate: true });
170
175
  onBeforeUnmount(() => {
171
- disabled.value = true;
176
+ unmounted.value = true;
172
177
  window.removeEventListener("keydown", setIsSelecting);
173
178
  window.removeEventListener("keyup", resetIsSelecting);
174
179
  });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/rsmple/eco-vue-js.git"
6
6
  },
7
- "version": "0.10.6",
7
+ "version": "0.10.7",
8
8
  "scripts": {
9
9
  "build": "run-p type-check \"build-only {@}\" --",
10
10
  "preview": "vite preview",