awing-library 2.1.2-dev.583 → 2.1.2-dev.585

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.
@@ -9,7 +9,7 @@ var __webpack_modules__ = {
9
9
  "AWING/DataInput": function(module) {
10
10
  module.exports = __WEBPACK_EXTERNAL_MODULE__DataInput_index_js_c7933a4f__;
11
11
  },
12
- "../helper": function(module) {
12
+ "AWING/helper": function(module) {
13
13
  module.exports = __WEBPACK_EXTERNAL_MODULE__helper_js_663c9e82__;
14
14
  }
15
15
  };
@@ -92,9 +92,9 @@ jest.mock('@mui/material', ()=>({
92
92
  })
93
93
  }));
94
94
  const mockInputFactory = __webpack_require__("AWING/DataInput")["default"];
95
- const mockCalculateValue = __webpack_require__("../helper").calculateValue;
96
- const mockConvertFormulaToBinaryTree = __webpack_require__("../helper").convertFormulaToBinaryTree;
97
- const mockReplaceFieldsValue = __webpack_require__("../helper").replaceFieldsValue;
95
+ const mockCalculateValue = __webpack_require__("AWING/helper").calculateValue;
96
+ const mockConvertFormulaToBinaryTree = __webpack_require__("AWING/helper").convertFormulaToBinaryTree;
97
+ const mockReplaceFieldsValue = __webpack_require__("AWING/helper").replaceFieldsValue;
98
98
  describe('DataForm Component', ()=>{
99
99
  const mockFields = [
100
100
  {
@@ -1 +1 @@
1
- {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/AWING/DataGridGroups/TableCollaped/Container.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAQ,QAAQ,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,MAAM,mBAAmB,CAAC,SAAS,IAAI;IACzC,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC/B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,iBAAS,SAAS,CAAC,SAAS,SAAS,MAAM,EAAE,KAAK,EAAE,mBAAmB,CAAC,SAAS,CAAC,2CA4MjF;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/AWING/DataGridGroups/TableCollaped/Container.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAQ,QAAQ,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,MAAM,mBAAmB,CAAC,SAAS,IAAI;IACzC,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC/B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,iBAAS,SAAS,CAAC,SAAS,SAAS,MAAM,EAAE,KAAK,EAAE,mBAAmB,CAAC,SAAS,CAAC,2CAkMjF;AAED,eAAe,SAAS,CAAC"}
@@ -16,12 +16,12 @@ function Container_Container(props) {
16
16
  const [pageList, setPageList] = useAtom(atoms.pageList);
17
17
  const [groupFields, setGroupFields] = useAtom(atoms.groupFields);
18
18
  const setDragging = useSetAtom(atoms.dragging);
19
- const [hovered, setHovered] = useState(false);
19
+ const [_hovered, setHovered] = useState(false);
20
20
  const [sortType, setSortType] = useState({});
21
21
  useEffect(()=>{
22
22
  const newObject = Object.create({});
23
23
  cells.forEach((cell)=>{
24
- if (cell.onSort) newObject[cell.fieldName] = DataGridSortType.Ready;
24
+ if (cell.onSort) newObject[cell.fieldName] = cell.defaultSortType || DataGridSortType.Ready;
25
25
  });
26
26
  setSortType(newObject);
27
27
  }, [
@@ -72,7 +72,7 @@ function Container_Container(props) {
72
72
  }
73
73
  const newObject = Object.create({});
74
74
  cells.forEach((c)=>{
75
- if (c.onSort) if (c.fieldName !== cell.fieldName) newObject[cell.fieldName] = DataGridSortType.Ready;
75
+ if (c.onSort) if (c.fieldName !== cell.fieldName) newObject[c.fieldName] = DataGridSortType.Ready;
76
76
  else newObject[cell.fieldName] = newSort;
77
77
  });
78
78
  setSortType(newObject);
@@ -127,36 +127,23 @@ function Container_Container(props) {
127
127
  onClick: ()=>handleCellClick(cell),
128
128
  align: cell?.align || (cell?.isnumeric ? 'right' : 'left') || 'left',
129
129
  children: [
130
- !!cell?.onSort && /*#__PURE__*/ jsxs(Fragment, {
131
- children: [
132
- /*#__PURE__*/ jsx("span", {
133
- style: {
134
- opacity: sortType[cell.fieldName] === DataGridSortType.Ready ? 0.2 : 0
135
- },
136
- children: sortType[cell.fieldName] === DataGridSortType.Ready && /*#__PURE__*/ jsx(North, {
137
- sx: {
138
- fontSize: '0.8rem'
139
- }
140
- })
141
- }),
142
- /*#__PURE__*/ jsxs("span", {
143
- style: {
144
- opacity: sortType[cell.fieldName] !== DataGridSortType.Ready && hovered ? 0.5 : 0
145
- },
146
- children: [
147
- sortType[cell.fieldName] === DataGridSortType.Asc && /*#__PURE__*/ jsx(North, {
148
- sx: {
149
- fontSize: '0.8rem'
150
- }
151
- }),
152
- sortType[cell.fieldName] === DataGridSortType.Desc && /*#__PURE__*/ jsx(South, {
153
- sx: {
154
- fontSize: '0.8rem'
155
- }
156
- })
157
- ]
158
- })
159
- ]
130
+ !!cell?.onSort && /*#__PURE__*/ jsx("span", {
131
+ style: {
132
+ display: 'inline-flex',
133
+ alignItems: 'center',
134
+ opacity: sortType[cell.fieldName] === DataGridSortType.Ready ? 0.3 : 1
135
+ },
136
+ children: sortType[cell.fieldName] === DataGridSortType.Desc ? /*#__PURE__*/ jsx(South, {
137
+ sx: {
138
+ fontSize: '0.8rem',
139
+ color: sortType[cell.fieldName] !== DataGridSortType.Ready ? 'primary.main' : 'inherit'
140
+ }
141
+ }) : /*#__PURE__*/ jsx(North, {
142
+ sx: {
143
+ fontSize: '0.8rem',
144
+ color: sortType[cell.fieldName] === DataGridSortType.Asc ? 'primary.main' : 'inherit'
145
+ }
146
+ })
160
147
  }),
161
148
  cell?.label ?? ''
162
149
  ]
@@ -8,6 +8,7 @@ export type Cell<FieldName> = {
8
8
  align?: 'left' | 'center' | 'right';
9
9
  isnumeric?: boolean;
10
10
  onSort?: (fieldName: FieldName, sort: DataGridSortType) => void;
11
+ defaultSortType?: DataGridSortType;
11
12
  };
12
13
  export type Row = {
13
14
  [key: 'groupKeyId' | string]: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../../src/AWING/DataGridGroups/Types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,IAAI,CAAC,SAAS,IAAI;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACnE,CAAC;AAEF,MAAM,MAAM,GAAG,GAAG;IACd,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,SAAS,IAAI;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEjH,MA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,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEjH,MAAM,MAAM,QAAQ,CAAC,SAAS,IAAI,CAC9B,IAAI,EAAE;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACrB,EAED,OAAO,CAAC,EAAE,MAAM,EAEhB,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE,KAChC,OAAO,CAAC;IACT,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,YAAY,EAAE,SAAS,CAAC,EAAE,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.2-dev.583",
3
+ "version": "2.1.2-dev.585",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -1,106 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import "@testing-library/jest-dom";
3
- import "react";
4
- import { fireEvent, render } from "@testing-library/react";
5
- import { driver } from "./DateRangePicker.driver.js";
6
- import container_0 from "../container.js";
7
- import moment from "moment";
8
- var __webpack_require__ = {};
9
- (()=>{
10
- __webpack_require__.g = (()=>{
11
- if ('object' == typeof globalThis) return globalThis;
12
- try {
13
- return this || new Function('return this')();
14
- } catch (e) {
15
- if ('object' == typeof window) return window;
16
- }
17
- })();
18
- })();
19
- const initData = {
20
- autoFocus: false,
21
- autoFocusEndDate: false,
22
- initialStartDate: null,
23
- initialEndDate: null,
24
- callback: ()=>{},
25
- disabled: false,
26
- isDayBlocked: (day)=>false,
27
- isOutsideRange: (day)=>false,
28
- isShowCalendarInfo: false,
29
- handleValid: ()=>{},
30
- handleDateRangePopover: ()=>{}
31
- };
32
- describe('Render', ()=>{
33
- it('should render input mask', ()=>{
34
- const { container } = render(/*#__PURE__*/ jsx(container_0, {
35
- ...initData
36
- }));
37
- const inputmask = container.querySelector(driver.inputmask);
38
- expect(inputmask).toBeInTheDocument();
39
- });
40
- it('should show popper when clicked inputmask', ()=>{
41
- jest.useFakeTimers();
42
- jest.spyOn(__webpack_require__.g, 'setTimeout');
43
- const { container } = render(/*#__PURE__*/ jsx(container_0, {
44
- ...initData
45
- }));
46
- const inputmask = container.querySelector(driver.inputmask);
47
- inputmask && fireEvent.click(inputmask);
48
- jest.advanceTimersByTime(1000);
49
- });
50
- it('should show popper when clicked inputmask', ()=>{
51
- jest.useFakeTimers();
52
- jest.spyOn(__webpack_require__.g, 'setTimeout');
53
- const { container } = render(/*#__PURE__*/ jsx(container_0, {
54
- ...initData,
55
- value: {
56
- startDate: moment('2021-10-20'),
57
- endDate: moment('2021-10-25')
58
- }
59
- }));
60
- const inputmaskInput = container.querySelector(driver.inputmaskInput);
61
- expect(inputmaskInput).toHaveValue('20/10/2021 - 25/10/2021');
62
- });
63
- });
64
- describe('init', ()=>{
65
- it('should autofocus', ()=>{
66
- jest.mock('react-dates/constants', ()=>({
67
- START_DATE: 'startDate',
68
- END_DATE: 'endDate'
69
- }));
70
- const autoFocus = true;
71
- const autoFocusEndDate = false;
72
- render(/*#__PURE__*/ jsx(container_0, {
73
- ...initData,
74
- autoFocus: autoFocus,
75
- autoFocusEndDate: autoFocusEndDate
76
- }));
77
- if (autoFocus) 'startDate';
78
- else if (autoFocusEndDate) 'endDate';
79
- });
80
- it('should autoFocusEndDate', ()=>{
81
- jest.mock('react-dates/constants', ()=>({
82
- START_DATE: 'startDate',
83
- END_DATE: 'endDate'
84
- }));
85
- const autoFocus = false;
86
- const autoFocusEndDate = true;
87
- render(/*#__PURE__*/ jsx(container_0, {
88
- ...initData,
89
- autoFocusEndDate: autoFocusEndDate
90
- }));
91
- if (autoFocus) 'startDate';
92
- else if (autoFocusEndDate) 'endDate';
93
- });
94
- });
95
- describe('action', ()=>{
96
- it('should autoFocus', ()=>{
97
- const autoFocus = true;
98
- const { container } = render(/*#__PURE__*/ jsx(container_0, {
99
- ...initData,
100
- autoFocus: autoFocus
101
- }));
102
- const inputmaskButton = container.querySelector(driver.inputmaskButton);
103
- inputmaskButton && fireEvent.click(inputmaskButton);
104
- expect(inputmaskButton).toHaveBeenCalled();
105
- });
106
- });