awing-library 2.1.38 → 2.1.39

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.
@@ -69,7 +69,7 @@ var ViewInfo = function (_a) {
69
69
  }, []);
70
70
  var handleChangeForm = react_1.default.useCallback(function (obj, _valid, keyUpdate) {
71
71
  var _a;
72
- if ((0, lodash_1.isEmpty)(obj))
72
+ if (!keyUpdate)
73
73
  return;
74
74
  if (['templateTypeId', 'directoryId'].includes(keyUpdate)) {
75
75
  if (keyUpdate === 'directoryId') {
@@ -118,7 +118,7 @@ var ViewInfo = function (_a) {
118
118
  };
119
119
  var templateOptions = react_1.default.useMemo(function () {
120
120
  var result = [];
121
- if (Boolean(viewInfoData.templateTypeId)) {
121
+ if (viewInfoData.templateTypeId) {
122
122
  templates
123
123
  .filter(function (x) {
124
124
  return x.pageCode ===
@@ -135,8 +135,7 @@ var ViewInfo = function (_a) {
135
135
  })
136
136
  .forEach(function (template) { return result.push(template); });
137
137
  }
138
- var resultSet = new Set(result);
139
- return Array.from(resultSet);
138
+ return result.sort(function (a, b) { return a.description.localeCompare(b.description); });
140
139
  }, [viewInfoData, templates, pageCode]);
141
140
  return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(AWING_1.DataForm, { fields: [
142
141
  {
@@ -110,7 +110,7 @@ function DataInput(props) {
110
110
  case 'autocomplete': {
111
111
  return ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, { multiple: fieldDefinition.multiple, options: fieldDefinition.options, getOptionLabel: function (option) { var _a, _b; return (_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.text) !== null && _b !== void 0 ? _b : ''; }, isOptionEqualToValue: function (option, value) {
112
112
  return (option === null || option === void 0 ? void 0 : option.value) === (value === null || value === void 0 ? void 0 : value.value);
113
- }, disableclearable: fieldDefinition.disableClearable, getOptionDisabled: function (option) { return option === null || option === void 0 ? void 0 : option.disabled; }, onChange: function (e, value) {
113
+ }, getOptionKey: function (option) { return option.value; }, disableclearable: fieldDefinition.disableClearable, getOptionDisabled: function (option) { return option === null || option === void 0 ? void 0 : option.disabled; }, onChange: function (e, value) {
114
114
  var newValue = fieldDefinition.multiple
115
115
  ? value.map(function (x) { return x === null || x === void 0 ? void 0 : x.value; })
116
116
  : value === null || value === void 0 ? void 0 : value.value;
@@ -7,7 +7,45 @@ export interface GridSortModel {
7
7
  field: string;
8
8
  sort: GridSortDirection;
9
9
  }
10
- export interface DataGridColumnDefinition {
10
+ interface DataGridColumnDefinitionBase {
11
+ /**
12
+ * Tên trường
13
+ */
14
+ field: string;
15
+ /**
16
+ * Nội dung hiển thị ở header
17
+ */
18
+ headerName: ReactNode;
19
+ /**
20
+ * Nếu bằng true thì sẽ cho phép sort theo trường này
21
+ */
22
+ sortable?: boolean;
23
+ options?: any[];
24
+ /**
25
+ * Hàm kiểm tra giá trị điền khi sửa trực tiếp trường này
26
+ *
27
+ * @param value Giá trị
28
+ */
29
+ checkValid?(value: any): boolean;
30
+ /**
31
+ * Kiểu dữ liệu của trường
32
+ */
33
+ type?: 'text' | 'number';
34
+ /**
35
+ * Cách lấy nội dung hiển thị khác, nếu có
36
+ *
37
+ * @param row Một đối tượng trong danh sách hiển thị
38
+ * @param idx Số thứ tự của đối tượng trong danh sách
39
+ */
40
+ valueGetter?(row: any, idx: number, stt: number): ReactNode;
41
+ /**
42
+ * Độ rộng của cột
43
+ */
44
+ width?: string | number;
45
+ TableCellProps?: TableCellProps;
46
+ dynamicTableCellProps?: (row: any) => TableCellProps;
47
+ }
48
+ export interface DataGridColumnDefinition extends DataGridColumnDefinitionBase {
11
49
  /**
12
50
  * Tên trường
13
51
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.38",
3
+ "version": "2.1.39",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",