eservices-core 1.0.574 → 1.0.576

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.
@@ -165,7 +165,7 @@ export declare function useListFilter(list: List): IFilters;
165
165
  * @param storedItems - Реактивный объект значений. Может передаваться как ref и как reactive
166
166
  */
167
167
  export declare function useListSelect<T>(storedItems: Ref<T[]> | T[]): (T[] | import("vue").ComputedRef<boolean> | ((value?: T) => void))[];
168
- export declare type ListCellType = 'date' | 'dateWithTime' | 'dateTime' | 'toggle' | 'select' | 'number';
168
+ export declare type ListCellType = 'date' | 'dateWithTime' | 'dateTime' | 'toggle' | 'select' | 'number' | 'multi-select';
169
169
  export interface IDefaultListData {
170
170
  [LIST_ROW_KEY]: number;
171
171
  }
@@ -1,8 +1,14 @@
1
- import { IListCell, IDefaultListData } from "./List";
1
+ import { IListCell } from "./List";
2
2
  import { VNode } from "vue";
3
- /**
4
- * @description Получение ОДНОЙ строки таблицы или списка.
5
- */
6
- export default function getTableRow(config: IListCell[], values: IDefaultListData): VNode<import("vue").RendererNode, import("vue").RendererElement, {
3
+ export declare function setupListRow<T extends IRowProps, U extends IRowContext>(props: T, context: U): () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
4
  [key: string]: any;
8
5
  }>;
6
+ interface IRowProps {
7
+ config: IListCell[];
8
+ values: Record<string, any>;
9
+ selected: boolean;
10
+ }
11
+ interface IRowContext {
12
+ emit: any;
13
+ }
14
+ export {};
@@ -1,8 +1,9 @@
1
+ import { setupListRow as setup } from "../../classes/new/get-table-row";
1
2
  declare const _default: {
2
3
  props: {
3
4
  config: ArrayConstructor;
4
5
  values: ObjectConstructor;
5
6
  };
6
- setup(props: any): () => any;
7
+ setup: typeof setup;
7
8
  };
8
9
  export default _default;
@@ -1,11 +1,10 @@
1
+ import { setupListRow as setup } from "../../classes/new/get-table-row";
1
2
  declare const _default: {
2
3
  props: {
3
4
  values: ObjectConstructor;
4
5
  config: ObjectConstructor;
5
6
  selected: BooleanConstructor;
6
7
  };
7
- setup(props: any): () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
8
- [key: string]: any;
9
- }>;
8
+ setup: typeof setup;
10
9
  };
11
10
  export default _default;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * eservices-core v1.0.574
2
+ * eservices-core v1.0.576
3
3
  * (c) 2023 ESERVICES
4
4
  */
5
5
  'use strict';
@@ -3559,11 +3559,12 @@ function prettyDate(str, format = 'YYYY/MM/DD') {
3559
3559
  /**
3560
3560
  * @description Получение ОДНОЙ строки таблицы или списка.
3561
3561
  */
3562
- function getTableRow$1(config, values) {
3563
- const arrayCells = config.map(cell => getTableCell$1(cell, values));
3562
+ function getTableRow$1(props, context) {
3563
+ const arrayCells = props.config.map(cell => getTableCell$1(cell, props, context));
3564
3564
  return vue.h("tr", { class: 'widget-table__row widget-table-row' }, arrayCells);
3565
3565
  }
3566
- function getTableCell$1(cell, rowValue) {
3566
+ function getTableCell$1(cell, props, context) {
3567
+ const rowValue = props.values;
3567
3568
  //@ts-ignore
3568
3569
  let { name, value } = List.getCellInfo(cell, rowValue);
3569
3570
  const attributes = {
@@ -3604,6 +3605,11 @@ function getTableCell$1(cell, rowValue) {
3604
3605
  value = prettyDateWithTime(typeof value === "string" ? value : null);
3605
3606
  break;
3606
3607
  }
3608
+ case "multi-select": {
3609
+ const node = getSelectNode(props.selected);
3610
+ cellNodeChildren.push(node);
3611
+ addHandleClick(select.bind(null, context, true));
3612
+ }
3607
3613
  }
3608
3614
  }
3609
3615
  if (cell.onClick)
@@ -3645,6 +3651,20 @@ function getTableCell$1(cell, rowValue) {
3645
3651
  // Добавление обычной ячейки со значением
3646
3652
  outputNodes.push(vue.h("td", attributes, cellNodeChildren));
3647
3653
  return outputNodes;
3654
+ }
3655
+ function getSelectNode(value) {
3656
+ return vue.h('div', {
3657
+ class: {
3658
+ 'table-cell-toggle': true,
3659
+ 'table-cell-toggle_active': value
3660
+ }
3661
+ });
3662
+ }
3663
+ function select(context, value) {
3664
+ context.emit('select', value);
3665
+ }
3666
+ function setupListRow(props, context) {
3667
+ return () => getTableRow$1(props, context);
3648
3668
  }
3649
3669
 
3650
3670
  var script$l = {
@@ -3653,9 +3673,7 @@ var script$l = {
3653
3673
  config: Object,
3654
3674
  selected: Boolean
3655
3675
  },
3656
- setup(props) {
3657
- return () => getTableRow$1(props.config, props.values);
3658
- }
3676
+ setup: setupListRow
3659
3677
  };
3660
3678
 
3661
3679
  script$l.__file = "core/widgets/new/widget-table-row.vue";
@@ -3797,8 +3815,8 @@ var script$i = /*#__PURE__*/ vue.defineComponent({
3797
3815
  vue.createVNode(script$l, {
3798
3816
  config: __props.config,
3799
3817
  values: values,
3800
- selected: (_a = __props.selectRows) === null || _a === void 0 ? void 0 : _a.includes(hash),
3801
- onSelect: ($event) => (onSelect(hash, $event)),
3818
+ selected: (_a = __props.selectRows) === null || _a === void 0 ? void 0 : _a.includes(values),
3819
+ onSelect: ($event) => (onSelect(values, $event)),
3802
3820
  class: vue.normalizeClass(!!__props.classCallback ? __props.classCallback(values) : '')
3803
3821
  }, null, 8 /* PROPS */, ["config", "values", "selected", "onSelect", "class"]),
3804
3822
  (vue.unref(tableForm) && (__props.activeRow === hash))
@@ -3980,16 +3998,7 @@ var script$f = {
3980
3998
  config: Array,
3981
3999
  values: Object
3982
4000
  },
3983
- setup(props) {
3984
- let elem = null;
3985
- try {
3986
- elem = getTableRow$1(props.config, props.values);
3987
- }
3988
- catch (e) {
3989
- console.warn('[widget-list-row]', e);
3990
- }
3991
- return () => elem;
3992
- }
4001
+ setup: setupListRow
3993
4002
  };
3994
4003
 
3995
4004
  var css_248z$b = "\ntr[data-v-65df50d5] {\r\n\tborder: 1px solid #F3F4FC;\r\n\theight: 30px;\n}\nth[data-v-65df50d5],\r\ntd[data-v-65df50d5] {\r\n\tposition: relative;\r\n\r\n\tpadding: 0 9px;\n}\nth[data-v-65df50d5] {\r\n\ttext-align: left;\n}\np[data-v-65df50d5] {\r\n\tmargin: 0;\r\n\twhite-space: nowrap;\r\n\ttext-overflow: ellipsis;\r\n\toverflow: hidden;\n}\r\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.0.574",
3
+ "version": "1.0.576",
4
4
  "description": "Core library",
5
5
  "author": "",
6
6
  "scripts": {