@akinon/akitable 0.3.9 → 0.3.10

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.
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { AkitableData } from '../types';
4
4
  interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
5
5
  editing: boolean;
6
- dataIndex: string;
6
+ dataIndex: string | string[];
7
7
  title: any;
8
8
  record: AkitableData;
9
9
  index: number;
@@ -1 +1 @@
1
- {"version":3,"file":"EditableCell.d.ts","sourceRoot":"","sources":["../../../src/components/EditableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CA6BtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"EditableCell.d.ts","sourceRoot":"","sources":["../../../src/components/EditableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAoCtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -17,12 +17,19 @@ const ui_input_1 = require("@akinon/ui-input");
17
17
  const react_1 = require("react");
18
18
  const EditableCell = (_a) => {
19
19
  var { editing, dataIndex, title, record, children } = _a, restProps = __rest(_a, ["editing", "dataIndex", "title", "record", "children"]);
20
+ let initialValue = null;
21
+ if (dataIndex && Array.isArray(dataIndex)) {
22
+ initialValue = dataIndex.reduce((acc, key) => acc === null || acc === void 0 ? void 0 : acc[key], record);
23
+ }
24
+ else {
25
+ initialValue = record === null || record === void 0 ? void 0 : record[dataIndex];
26
+ }
20
27
  return (react_1.default.createElement("td", Object.assign({}, restProps), editing ? (react_1.default.createElement(akiform_1.Akiform.Item, { name: dataIndex, style: { margin: 0 }, rules: [
21
28
  {
22
29
  required: true,
23
30
  message: `Missing ${title}!`
24
31
  }
25
- ], initialValue: record[dataIndex] },
32
+ ], initialValue: initialValue },
26
33
  react_1.default.createElement(ui_input_1.Input, null))) : (children)));
27
34
  };
28
35
  exports.default = EditableCell;
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { AkitableData } from '../types';
4
4
  interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
5
5
  editing: boolean;
6
- dataIndex: string;
6
+ dataIndex: string | string[];
7
7
  title: any;
8
8
  record: AkitableData;
9
9
  index: number;
@@ -1 +1 @@
1
- {"version":3,"file":"EditableCell.d.ts","sourceRoot":"","sources":["../../../src/components/EditableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CA6BtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"EditableCell.d.ts","sourceRoot":"","sources":["../../../src/components/EditableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAoCtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -15,12 +15,19 @@ import { Input } from '@akinon/ui-input';
15
15
  import React from 'react';
16
16
  const EditableCell = (_a) => {
17
17
  var { editing, dataIndex, title, record, children } = _a, restProps = __rest(_a, ["editing", "dataIndex", "title", "record", "children"]);
18
+ let initialValue = null;
19
+ if (dataIndex && Array.isArray(dataIndex)) {
20
+ initialValue = dataIndex.reduce((acc, key) => acc === null || acc === void 0 ? void 0 : acc[key], record);
21
+ }
22
+ else {
23
+ initialValue = record === null || record === void 0 ? void 0 : record[dataIndex];
24
+ }
18
25
  return (React.createElement("td", Object.assign({}, restProps), editing ? (React.createElement(Akiform.Item, { name: dataIndex, style: { margin: 0 }, rules: [
19
26
  {
20
27
  required: true,
21
28
  message: `Missing ${title}!`
22
29
  }
23
- ], initialValue: record[dataIndex] },
30
+ ], initialValue: initialValue },
24
31
  React.createElement(Input, null))) : (children)));
25
32
  };
26
33
  export default EditableCell;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/akitable",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
@@ -13,12 +13,12 @@
13
13
  "clsx": "^2.0.0",
14
14
  "react-error-boundary": "^4.0.13",
15
15
  "@akinon/akilocale": "0.10.1",
16
- "@akinon/akiform": "0.7.0",
17
16
  "@akinon/icons": "0.4.0",
17
+ "@akinon/ui-card": "0.3.0",
18
18
  "@akinon/ui-button": "0.5.0",
19
+ "@akinon/akiform": "0.7.0",
19
20
  "@akinon/ui-input": "0.4.0",
20
21
  "@akinon/ui-pagination": "0.3.0",
21
- "@akinon/ui-card": "0.3.0",
22
22
  "@akinon/ui-result": "0.1.0",
23
23
  "@akinon/ui-select": "0.3.0",
24
24
  "@akinon/ui-skeleton": "0.3.0",
@@ -33,8 +33,8 @@
33
33
  "copyfiles": "^2.4.1",
34
34
  "rimraf": "^5.0.5",
35
35
  "typescript": "^5.2.2",
36
- "@akinon/eslint-config": "0.1.0",
37
36
  "@akinon/vite-config": "0.4.0",
37
+ "@akinon/eslint-config": "0.1.0",
38
38
  "@akinon/typescript-config": "0.2.0"
39
39
  },
40
40
  "peerDependencies": {