mrxy-yk 1.12.2 → 1.12.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.
@@ -1,4 +1,5 @@
1
1
  import { FormRules } from 'element-plus';
2
+ import { HotInstance } from 'handsontable';
2
3
  import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
4
  type __VLS_Props = {
4
5
  data: Record<PropertyKey, any>[];
@@ -10,7 +11,7 @@ type __VLS_Slots = {} & {
10
11
  default?: (props: typeof __VLS_9) => any;
11
12
  };
12
13
  declare const __VLS_base: DefineComponent<__VLS_Props, {
13
- readonly hotInstance: any;
14
+ readonly hotInstance: HotInstance;
14
15
  redrawing(data?: Record<PropertyKey, any>[]): void;
15
16
  validate(): Promise<unknown>;
16
17
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
@@ -108,7 +108,9 @@ var FormTable_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
108
108
  callback(true);
109
109
  return;
110
110
  }
111
- const error = await validatorRaw(rules[i], value, tableData[row]);
111
+ const physicalRow = hotInstance.toPhysicalRow(row);
112
+ const rawRow = hotInstance.getSourceDataAtRow(physicalRow);
113
+ const error = await validatorRaw(rules[i], value, rawRow);
112
114
  if (error) {
113
115
  if (ObjectUtil.isNotEmpty(row)) {
114
116
  console.log(error.message);
@@ -17,7 +17,7 @@ var FormTableColumn_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
17
17
  function reloadTd(td) {
18
18
  const prev = tdMap.get(td);
19
19
  if (prev) {
20
- prev.destroy();
20
+ prev.destroy?.();
21
21
  render(null, prev.wrapper);
22
22
  prev.wrapper.remove();
23
23
  tdMap.delete(td);
@@ -26,12 +26,28 @@ var FormTableColumn_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
26
26
  td.classList.add("yk-form-table-column");
27
27
  }
28
28
  function slotRender(instance, td, row, col, _prop, value, wrapper, slotName = "default") {
29
- const rowData = reactive((instance.getSourceData?.() ?? [])[row] ?? {});
30
- const watchHandle = watch(() => rowData[_prop], (newVal) => {
31
- if (instance.getDataAtCell?.(row, col) !== newVal) instance.setDataAtCell?.(row, col, newVal);
32
- });
29
+ const physicalRow = instance.toPhysicalRow(row);
30
+ const rawRow = instance.getSourceDataAtRow(physicalRow);
31
+ let rowData = rawRow;
33
32
  const targetSlot = slots[slotName];
34
33
  if (!targetSlot) return;
34
+ if (slotName === "default") tdMap.set(td, {
35
+ wrapper,
36
+ row,
37
+ col
38
+ });
39
+ else if (slotName === "selection") {
40
+ rowData = reactive(rawRow);
41
+ const watchHandle = watch(() => rowData[_prop], (newVal) => {
42
+ if (instance.getDataAtCell?.(row, col) !== newVal) instance.setDataAtCell?.(row, col, newVal);
43
+ });
44
+ tdMap.set(td, {
45
+ wrapper,
46
+ destroy: watchHandle,
47
+ row,
48
+ col
49
+ });
50
+ }
35
51
  const vNodes = targetSlot({
36
52
  row: rowData,
37
53
  value,
@@ -44,15 +60,6 @@ var FormTableColumn_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
44
60
  return;
45
61
  }
46
62
  render(createVNode(Fragment, null, vNodes.map((vn) => cloneVNode(vn))), wrapper);
47
- const destroy = () => {
48
- watchHandle();
49
- };
50
- tdMap.set(td, {
51
- wrapper,
52
- destroy,
53
- row,
54
- col
55
- });
56
63
  }
57
64
  function isMultiSelected(instance) {
58
65
  const selected = instance.getSelected?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mrxy-yk",
3
- "version": "1.12.2",
3
+ "version": "1.12.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "A collection of Vue 3 components and utilities",
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "mrxy-yk",
4
- "version": "1.12.2",
4
+ "version": "1.12.3",
5
5
  "js-types-syntax": "typescript",
6
6
  "contributions": {
7
7
  "html": {