playbook_ui 14.11.0.pre.rc.6 → 14.11.0.pre.rc.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90f0123e3995ace5639733d29921fbb16fab9b2d33ade22943e730de7354462f
4
- data.tar.gz: cc98b9bc9a33a7786acec47a68ff3453630c0394d7dffb9620fc25fd0b9e52c4
3
+ metadata.gz: 5a51bf0c8f5dfdb651880e4544548c9c67a106549d4c4d94a726cbdcbaa41b8a
4
+ data.tar.gz: 5f403c3864bb357c4e2f93c55fdbcdfe1c4fba6e6be6c7780559798c48d2bc7e
5
5
  SHA512:
6
- metadata.gz: 2f417b8df46ee94165dc64e48ea31d5dc36fa4f2c9a87149021cbc7a975c759f5ee0e2895fefcf14c3701bfcbcca88b55d88fcb356b0af1309c6e07eb0f3824f
7
- data.tar.gz: e49a36cb29ad2001e8b1155336b88b3c4d82e1a171234e05cf0d03414544fb7796e517ef237d7192223e42a8fcf1aee8b64cc647bc5746e128e3f0ad57ca871d
6
+ metadata.gz: d73014d82ad3ff494e9e482b9d01f6cecd0b8b87bb80d2af581e9b9ab336d9c18a9640aeba052aa2f6a8a011632457efc34fc54d1b7af5110f1b995d71d94594
7
+ data.tar.gz: 7820f011695d249d5ab5da5b6d29b57002434d10e3c49a2faeb2f2bdcef446244bc70cc392c9f6bbabf9f965c1c7162cdb55d1435ffc850a6c87da74d9ac709b
@@ -28,7 +28,8 @@ type TableProps = {
28
28
  singleLine?: boolean,
29
29
  size?: "sm" | "md" | "lg",
30
30
  sticky?: boolean,
31
- stickyLeftcolumn?: string[],
31
+ stickyLeftColumn?: string[],
32
+ stickyRightColumn?: string[],
32
33
  striped?: boolean,
33
34
  tag?: "table" | "div",
34
35
  verticalBorder?: boolean,
@@ -52,7 +53,8 @@ const Table = (props: TableProps): React.ReactElement => {
52
53
  singleLine = false,
53
54
  size = 'sm',
54
55
  sticky = false,
55
- stickyLeftcolumn = [],
56
+ stickyLeftColumn = [],
57
+ stickyRightColumn= [],
56
58
  striped = false,
57
59
  tag = 'table',
58
60
  verticalBorder = false,
@@ -79,7 +81,8 @@ const Table = (props: TableProps): React.ReactElement => {
79
81
  'single-line': singleLine,
80
82
  'no-hover': disableHover,
81
83
  'sticky-header': sticky,
82
- 'sticky-left-column': stickyLeftcolumn,
84
+ 'sticky-left-column': stickyLeftColumn,
85
+ 'sticky-right-column': stickyRightColumn,
83
86
  'striped': striped,
84
87
  [outerPaddingCss]: outerPadding !== '',
85
88
  },
@@ -90,11 +93,12 @@ const Table = (props: TableProps): React.ReactElement => {
90
93
  )
91
94
 
92
95
  useEffect(() => {
93
- const handleStickyColumns = () => {
96
+ const handleStickyLeftColumns = () => {
97
+ if (!stickyLeftColumn.length) return;
94
98
  let accumulatedWidth = 0;
95
99
 
96
- stickyLeftcolumn.forEach((colId, index) => {
97
- const isLastColumn = index === stickyLeftcolumn.length - 1;
100
+ stickyLeftColumn.forEach((colId, index) => {
101
+ const isLastColumn = index === stickyLeftColumn.length - 1;
98
102
  const header = document.querySelector(`th[id="${colId}"]`);
99
103
  const cells = document.querySelectorAll(`td[id="${colId}"]`);
100
104
 
@@ -103,11 +107,11 @@ const Table = (props: TableProps): React.ReactElement => {
103
107
  (header as HTMLElement).style.left = `${accumulatedWidth}px`;
104
108
 
105
109
  if (!isLastColumn) {
106
- header.classList.add('with-border');
107
- header.classList.remove('sticky-shadow');
110
+ header.classList.add('with-border-right');
111
+ header.classList.remove('sticky-left-shadow');
108
112
  } else {
109
- header.classList.remove('with-border');
110
- header.classList.add('sticky-shadow');
113
+ header.classList.remove('with-border-right');
114
+ header.classList.add('sticky-left-shadow');
111
115
  }
112
116
 
113
117
  accumulatedWidth += (header as HTMLElement).offsetWidth;
@@ -118,26 +122,71 @@ const Table = (props: TableProps): React.ReactElement => {
118
122
  (cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
119
123
 
120
124
  if (!isLastColumn) {
121
- cell.classList.add('with-border');
122
- cell.classList.remove('sticky-shadow');
125
+ cell.classList.add('with-border-right');
126
+ cell.classList.remove('sticky-left-shadow');
123
127
  } else {
124
- cell.classList.remove('with-border');
125
- cell.classList.add('sticky-shadow');
128
+ cell.classList.remove('with-border-right');
129
+ cell.classList.add('sticky-left-shadow');
126
130
  }
127
131
  });
128
132
  });
129
133
  };
130
134
 
131
135
  setTimeout(() => {
132
- handleStickyColumns();
136
+ handleStickyLeftColumns();
133
137
  }, 10);
134
138
 
135
- window.addEventListener('resize', handleStickyColumns);
139
+ window.addEventListener('resize', handleStickyLeftColumns);
136
140
 
137
141
  return () => {
138
- window.removeEventListener('resize', handleStickyColumns);
142
+ window.removeEventListener('resize', handleStickyLeftColumns);
139
143
  };
140
- }, [stickyLeftcolumn]);
144
+ }, [stickyLeftColumn]);
145
+
146
+ useEffect(() => {
147
+ const handleStickyRightColumns = () => {
148
+ if (!stickyRightColumn.length) return;
149
+ let accumulatedWidth = 0;
150
+
151
+ stickyRightColumn.reverse().forEach((colId, index) => {
152
+ const isLastColumn = index === stickyRightColumn.length - 1;
153
+ const header = document.querySelector(`th[id="${colId}"]`);
154
+ const cells = document.querySelectorAll(`td[id="${colId}"]`);
155
+
156
+ if (header) {
157
+ header.classList.add('sticky');
158
+ (header as HTMLElement).style.right = `${accumulatedWidth}px`;
159
+
160
+ if (!isLastColumn) {
161
+ header.classList.add('with-border-left');
162
+ header.classList.remove('sticky-right-shadow');
163
+ } else {
164
+ header.classList.remove('with-border-left');
165
+ header.classList.add('sticky-right-shadow');
166
+ }
167
+
168
+ accumulatedWidth += (header as HTMLElement).offsetWidth;
169
+ }
170
+
171
+ cells.forEach((cell) => {
172
+ cell.classList.add('sticky');
173
+ (cell as HTMLElement).style.right = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
174
+
175
+ if (!isLastColumn) {
176
+ cell.classList.add('with-border-left');
177
+ cell.classList.remove('sticky-right-shadow');
178
+ } else {
179
+ cell.classList.remove('with-border-left');
180
+ cell.classList.add('sticky-right-shadow');
181
+ }
182
+ });
183
+ });
184
+ };
185
+
186
+ setTimeout(() => {
187
+ handleStickyRightColumns();
188
+ }, 10);
189
+ }, [stickyRightColumn]);
141
190
 
142
191
  useEffect(() => {
143
192
  const instance = new PbTable()
@@ -0,0 +1,88 @@
1
+ import React from 'react'
2
+ import Table from '../_table'
3
+
4
+ const TableStickyColumns = () => {
5
+ return (
6
+ <Table
7
+ responsive="scroll"
8
+ size="md"
9
+ stickyLeftColumn={["a"]}
10
+ stickyRightColumn={["b"]}
11
+ >
12
+ <thead>
13
+ <tr>
14
+ <th id="a">{'Column 1'}</th>
15
+ <th>{'Column 2'}</th>
16
+ <th>{'Column 3'}</th>
17
+ <th>{'Column 4'}</th>
18
+ <th>{'Column 5'}</th>
19
+ <th>{'Column 6'}</th>
20
+ <th>{'Column 7'}</th>
21
+ <th>{'Column 8'}</th>
22
+ <th>{'Column 9'}</th>
23
+ <th>{'Column 10'}</th>
24
+ <th>{'Column 11'}</th>
25
+ <th>{'Column 12'}</th>
26
+ <th>{'Column 13'}</th>
27
+ <th>{'Column 14'}</th>
28
+ <th id="b">{'Column 15'}</th>
29
+ </tr>
30
+ </thead>
31
+ <tbody>
32
+ <tr>
33
+ <td id="a">{'Value 1'}</td>
34
+ <td>{'Value 2'}</td>
35
+ <td>{'Value 3'}</td>
36
+ <td>{'Value 4'}</td>
37
+ <td>{'Value 5'}</td>
38
+ <td>{'Value 6'}</td>
39
+ <td>{'Value 7'}</td>
40
+ <td>{'Value 8'}</td>
41
+ <td>{'Value 9'}</td>
42
+ <td>{'Value 10'}</td>
43
+ <td>{'Value 11'}</td>
44
+ <td>{'Value 12'}</td>
45
+ <td>{'Value 13'}</td>
46
+ <td>{'Value 14'}</td>
47
+ <td id="b">{'Value 15'}</td>
48
+ </tr>
49
+ <tr>
50
+ <td id="a">{'Value 1'}</td>
51
+ <td>{'Value 2'}</td>
52
+ <td>{'Value 3'}</td>
53
+ <td>{'Value 4'}</td>
54
+ <td>{'Value 5'}</td>
55
+ <td>{'Value 6'}</td>
56
+ <td>{'Value 7'}</td>
57
+ <td>{'Value 8'}</td>
58
+ <td>{'Value 9'}</td>
59
+ <td>{'Value 10'}</td>
60
+ <td>{'Value 11'}</td>
61
+ <td>{'Value 12'}</td>
62
+ <td>{'Value 13'}</td>
63
+ <td>{'Value 14'}</td>
64
+ <td id="b">{'Value 15'}</td>
65
+ </tr>
66
+ <tr>
67
+ <td id="a">{'Value 1'}</td>
68
+ <td>{'Value 2'}</td>
69
+ <td>{'Value 3'}</td>
70
+ <td>{'Value 4'}</td>
71
+ <td>{'Value 5'}</td>
72
+ <td>{'Value 6'}</td>
73
+ <td>{'Value 7'}</td>
74
+ <td>{'Value 8'}</td>
75
+ <td>{'Value 9'}</td>
76
+ <td>{'Value 10'}</td>
77
+ <td>{'Value 11'}</td>
78
+ <td>{'Value 12'}</td>
79
+ <td>{'Value 13'}</td>
80
+ <td>{'Value 14'}</td>
81
+ <td id="b">{'Value 15'}</td>
82
+ </tr>
83
+ </tbody>
84
+ </Table>
85
+ )
86
+ }
87
+
88
+ export default TableStickyColumns
@@ -0,0 +1,3 @@
1
+ The `stickyLeftColumn` and `stickyRightColumn` props can be used together on the same table as needed.
2
+
3
+ Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using props.
@@ -6,7 +6,7 @@ const TableStickyLeftColumns = () => {
6
6
  <Table
7
7
  responsive="scroll"
8
8
  size="md"
9
- stickyLeftcolumn={["1", "2", "3"]}
9
+ stickyLeftColumn={["1", "2", "3"]}
10
10
  >
11
11
  <thead>
12
12
  <tr>
@@ -1 +1,3 @@
1
1
  The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
2
+
3
+ Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the `stickyLeftColumn`.
@@ -1,2 +1,5 @@
1
1
  The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
2
- If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
2
+
3
+ If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
4
+
5
+ Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using `stickyLeftColumn` prop.
@@ -0,0 +1,87 @@
1
+ import React from 'react'
2
+ import Table from '../_table'
3
+
4
+ const TableStickyRightColumns = () => {
5
+ return (
6
+ <Table
7
+ responsive="scroll"
8
+ size="md"
9
+ stickyRightColumn={["13", "14", "15"]}
10
+ >
11
+ <thead>
12
+ <tr>
13
+ <th>{'Column 1'}</th>
14
+ <th>{'Column 2'}</th>
15
+ <th>{'Column 3'}</th>
16
+ <th>{'Column 4'}</th>
17
+ <th>{'Column 5'}</th>
18
+ <th>{'Column 6'}</th>
19
+ <th>{'Column 7'}</th>
20
+ <th>{'Column 8'}</th>
21
+ <th>{'Column 9'}</th>
22
+ <th>{'Column 10'}</th>
23
+ <th>{'Column 11'}</th>
24
+ <th>{'Column 12'}</th>
25
+ <th id="13">{'Column 13'}</th>
26
+ <th id="14">{'Column 14'}</th>
27
+ <th id="15">{'Column 15'}</th>
28
+ </tr>
29
+ </thead>
30
+ <tbody>
31
+ <tr>
32
+ <td>{'Value 1'}</td>
33
+ <td>{'Value 2'}</td>
34
+ <td>{'Value 3'}</td>
35
+ <td>{'Value 4'}</td>
36
+ <td>{'Value 5'}</td>
37
+ <td>{'Value 6'}</td>
38
+ <td>{'Value 7'}</td>
39
+ <td>{'Value 8'}</td>
40
+ <td>{'Value 9'}</td>
41
+ <td>{'Value 10'}</td>
42
+ <td>{'Value 11'}</td>
43
+ <td>{'Value 12'}</td>
44
+ <td id="13">{'Value 13'}</td>
45
+ <td id="14">{'Value 14'}</td>
46
+ <td id="15">{'Value 15'}</td>
47
+ </tr>
48
+ <tr>
49
+ <td>{'Value 1'}</td>
50
+ <td>{'Value 2'}</td>
51
+ <td>{'Value 3'}</td>
52
+ <td>{'Value 4'}</td>
53
+ <td>{'Value 5'}</td>
54
+ <td>{'Value 6'}</td>
55
+ <td>{'Value 7'}</td>
56
+ <td>{'Value 8'}</td>
57
+ <td>{'Value 9'}</td>
58
+ <td>{'Value 10'}</td>
59
+ <td>{'Value 11'}</td>
60
+ <td>{'Value 12'}</td>
61
+ <td id="13">{'Value 13'}</td>
62
+ <td id="14">{'Value 14'}</td>
63
+ <td id="15">{'Value 15'}</td>
64
+ </tr>
65
+ <tr>
66
+ <td>{'Value 1'}</td>
67
+ <td>{'Value 2'}</td>
68
+ <td>{'Value 3'}</td>
69
+ <td>{'Value 4'}</td>
70
+ <td>{'Value 5'}</td>
71
+ <td>{'Value 6'}</td>
72
+ <td>{'Value 7'}</td>
73
+ <td>{'Value 8'}</td>
74
+ <td>{'Value 9'}</td>
75
+ <td>{'Value 10'}</td>
76
+ <td>{'Value 11'}</td>
77
+ <td>{'Value 12'}</td>
78
+ <td id="13">{'Value 13'}</td>
79
+ <td id="14">{'Value 14'}</td>
80
+ <td id="15">{'Value 15'}</td>
81
+ </tr>
82
+ </tbody>
83
+ </Table>
84
+ )
85
+ }
86
+
87
+ export default TableStickyRightColumns
@@ -0,0 +1,5 @@
1
+ The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
2
+
3
+ If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
4
+
5
+ Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the `stickyRightColumn` prop.
@@ -2,7 +2,7 @@ import PbEnhancedElement from '../pb_enhanced_element'
2
2
 
3
3
  export default class PbTable extends PbEnhancedElement {
4
4
  private stickyLeftColumns: string[] = [];
5
- private handleStickyColumnsRef: () => void;
5
+ private handleStickyLeftColumnsRef: () => void;
6
6
 
7
7
  static get selector(): string {
8
8
  return '.table-responsive-collapse'
@@ -31,10 +31,10 @@ export default class PbTable extends PbEnhancedElement {
31
31
  });
32
32
 
33
33
  // New sticky columns logic
34
- this.initStickyColumns();
34
+ this.initStickyLeftColumns();
35
35
  }
36
36
 
37
- private initStickyColumns(): void {
37
+ private initStickyLeftColumns(): void {
38
38
  // Find tables with sticky-left-column class
39
39
  const tables = document.querySelectorAll('.sticky-left-column');
40
40
 
@@ -52,16 +52,16 @@ export default class PbTable extends PbEnhancedElement {
52
52
 
53
53
  if (this.stickyLeftColumns.length > 0) {
54
54
  setTimeout(() => {
55
- this.handleStickyColumnsRef = this.handleStickyColumns.bind(this);
56
- this.handleStickyColumns();
57
- window.addEventListener('resize', this.handleStickyColumnsRef);
55
+ this.handleStickyLeftColumnsRef = this.handleStickyLeftColumns.bind(this);
56
+ this.handleStickyLeftColumns();
57
+ window.addEventListener('resize', this.handleStickyLeftColumnsRef);
58
58
  }, 10);
59
59
  }
60
60
  }
61
61
  });
62
62
  }
63
63
 
64
- private handleStickyColumns(): void {
64
+ private handleStickyLeftColumns(): void {
65
65
  let accumulatedWidth = 0;
66
66
 
67
67
  this.stickyLeftColumns.forEach((colId, index) => {
@@ -74,11 +74,11 @@ export default class PbTable extends PbEnhancedElement {
74
74
  (header as HTMLElement).style.left = `${accumulatedWidth}px`;
75
75
 
76
76
  if (!isLastColumn) {
77
- header.classList.add('with-border');
78
- header.classList.remove('sticky-shadow');
77
+ header.classList.add('with-border-right');
78
+ header.classList.remove('sticky-left-shadow');
79
79
  } else {
80
- header.classList.remove('with-border');
81
- header.classList.add('sticky-shadow');
80
+ header.classList.remove('with-border-right');
81
+ header.classList.add('sticky-left-shadow');
82
82
  }
83
83
 
84
84
  accumulatedWidth += (header as HTMLElement).offsetWidth;
@@ -89,11 +89,11 @@ export default class PbTable extends PbEnhancedElement {
89
89
  (cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
90
90
 
91
91
  if (!isLastColumn) {
92
- cell.classList.add('with-border');
93
- cell.classList.remove('sticky-shadow');
92
+ cell.classList.add('with-border-right');
93
+ cell.classList.remove('sticky-left-shadow');
94
94
  } else {
95
- cell.classList.remove('with-border');
96
- cell.classList.add('sticky-shadow');
95
+ cell.classList.remove('with-border-right');
96
+ cell.classList.add('sticky-left-shadow');
97
97
  }
98
98
  });
99
99
  });
@@ -101,8 +101,8 @@ export default class PbTable extends PbEnhancedElement {
101
101
 
102
102
  // Cleanup method to remove event listener
103
103
  disconnect(): void {
104
- if (this.handleStickyColumnsRef) {
105
- window.removeEventListener('resize', this.handleStickyColumnsRef);
104
+ if (this.handleStickyLeftColumnsRef) {
105
+ window.removeEventListener('resize', this.handleStickyLeftColumnsRef);
106
106
  }
107
107
  }
108
108
  }
@@ -8,8 +8,24 @@
8
8
  @media (max-width: 1600px) {
9
9
  &[class*="table-responsive-scroll"] {
10
10
  border-radius: 4px;
11
- box-shadow: 1px 0 0 0px $border_light
12
- }
11
+ box-shadow: 1px 0 0 0px $border_light,
12
+ -1px 0 0 0px $border_light
13
+ }
14
+
15
+ &[class^=pb_table].table-sm.table-card thead tr th:first-child,
16
+ &[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
17
+ border-left-width: 0px;
18
+ }
19
+
20
+ &[class^=pb_table].table-md.table-card thead tr th:first-child,
21
+ &[class^=pb_table].table-md:not(.no-hover).table-card tbody tr td:first-child {
22
+ border-left-width: 0px;
23
+ }
24
+
25
+ &[class^=pb_table].table-lg.table-card thead tr th:first-child,
26
+ &[class^=pb_table].table-lg:not(.no-hover).table-card tbody tr td:first-child {
27
+ border-left-width: 0px;
28
+ }
13
29
 
14
30
  &[class^=pb_table].table-sm.table-card thead tr th:last-child,
15
31
  &[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:last-child {
@@ -7,11 +7,25 @@
7
7
  background-color: white;
8
8
  }
9
9
 
10
- .with-border {
10
+ // For use with sticky left columns
11
+ .sticky-left-shadow {
12
+ box-shadow: 4px 0 10px rgba(60, 106, 172, 0.16) !important;
13
+ left: 0;
14
+ }
15
+
16
+ .with-border-right {
11
17
  border-right: 1px solid $border_light !important;
18
+ left: 0;
12
19
  }
13
20
 
14
- .sticky-shadow {
15
- box-shadow: 4px 0 10px rgba(60, 106, 172, 0.16) !important;
21
+ // For use with sticky right columns
22
+ .sticky-right-shadow {
23
+ box-shadow: -4px 0 10px rgba(60, 106, 172, 0.16) !important;
24
+ right: 0;
25
+ }
26
+
27
+ .with-border-left {
28
+ border-left: 1px solid $border_light !important;
29
+ right: 0;
16
30
  }
17
31
  }
@@ -1,4 +1,4 @@
1
- import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,useRef,createElement,useState,forwardRef,useLayoutEffect,useCallback,useImperativeHandle,Component,Fragment as Fragment$1}from"react";import{r as getDefaultExportFromCjs,x as filter,y as omit,u as useCollapsible,j as getAllIcons,z as get,q as commonjsGlobal,w as colors$1,t as highchartsTheme,A as merge,s as highchartsDarkTheme,B as getAugmentedNamespace,C as createPopper,E as uniqueId,F as typography,G as cloneDeep,H as isString}from"./lib-sMFo2JZy.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";import{TrixEditor}from"react-trix";import Trix from"trix";import require$$0 from"react-is";const initialState={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};const reducer=(state,action)=>{switch(action.type){case"SET_ITEMS":return Object.assign(Object.assign({},state),{items:action.payload});case"SET_DRAG_DATA":return Object.assign(Object.assign({},state),{dragData:action.payload});case"SET_IS_DRAGGING":return Object.assign(Object.assign({},state),{isDragging:action.payload});case"SET_ACTIVE_CONTAINER":return Object.assign(Object.assign({},state),{activeContainer:action.payload});case"CHANGE_CATEGORY":return Object.assign(Object.assign({},state),{items:state.items.map((item=>item.id===action.payload.itemId?Object.assign(Object.assign({},item),{container:action.payload.container}):item))});case"REORDER_ITEMS":{const{dragId:dragId,targetId:targetId}=action.payload;const newItems=[...state.items];const draggedItem=newItems.find((item=>item.id===dragId));const draggedIndex=newItems.indexOf(draggedItem);const targetIndex=newItems.findIndex((item=>item.id===targetId));newItems.splice(draggedIndex,1);newItems.splice(targetIndex,0,draggedItem);return Object.assign(Object.assign({},state),{items:newItems})}default:return state}};const DragContext=createContext({});const DraggableContext=()=>useContext(DragContext);const DraggableProvider=({children:children,initialItems:initialItems,onReorder:onReorder,onDragStart:onDragStart,onDragEnter:onDragEnter,onDragEnd:onDragEnd,onDrop:onDrop,onDragOver:onDragOver})=>{const[state,dispatch]=useReducer(reducer,initialState);useEffect((()=>{dispatch({type:"SET_ITEMS",payload:initialItems})}),[initialItems]);useEffect((()=>{onReorder(state.items)}),[state.items]);const handleDragStart=(id,container)=>{dispatch({type:"SET_DRAG_DATA",payload:{id:id,initialGroup:container}});dispatch({type:"SET_IS_DRAGGING",payload:id});if(onDragStart)onDragStart(id,container)};const handleDragEnter=(id,container)=>{if(state.dragData.id!==id){dispatch({type:"REORDER_ITEMS",payload:{dragId:state.dragData.id,targetId:id}});dispatch({type:"SET_DRAG_DATA",payload:{id:state.dragData.id,initialGroup:container}})}if(onDragEnter)onDragEnter(id,container)};const handleDragEnd=()=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});if(onDragEnd)onDragEnd()};const changeCategory=(itemId,container)=>{dispatch({type:"CHANGE_CATEGORY",payload:{itemId:itemId,container:container}})};const handleDrop=container=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});changeCategory(state.dragData.id,container);if(onDrop)onDrop(container)};const handleDragOver=(e,container)=>{e.preventDefault();dispatch({type:"SET_ACTIVE_CONTAINER",payload:container});if(onDragOver)onDragOver(e,container)};const contextValue=useMemo((()=>({items:state.items,dragData:state.dragData,isDragging:state.isDragging,activeContainer:state.activeContainer,handleDragStart:handleDragStart,handleDragEnter:handleDragEnter,handleDragEnd:handleDragEnd,handleDrop:handleDrop,handleDragOver:handleDragOver})),[state]);return jsx$1(DragContext.Provider,Object.assign({value:contextValue},{children:children}),void 0)};var classnames$1={exports:{}};
1
+ import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,useRef,createElement,useState,forwardRef,useLayoutEffect,useCallback,useImperativeHandle,Component,Fragment as Fragment$1}from"react";import{r as getDefaultExportFromCjs,x as filter,y as omit,u as useCollapsible,j as getAllIcons,z as get,q as commonjsGlobal,w as colors$1,t as highchartsTheme,A as merge,s as highchartsDarkTheme,B as getAugmentedNamespace,C as createPopper,E as uniqueId,F as typography,G as cloneDeep,H as isString}from"./lib-B7sgJtGS.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";import{TrixEditor}from"react-trix";import Trix from"trix";import require$$0 from"react-is";const initialState={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};const reducer=(state,action)=>{switch(action.type){case"SET_ITEMS":return Object.assign(Object.assign({},state),{items:action.payload});case"SET_DRAG_DATA":return Object.assign(Object.assign({},state),{dragData:action.payload});case"SET_IS_DRAGGING":return Object.assign(Object.assign({},state),{isDragging:action.payload});case"SET_ACTIVE_CONTAINER":return Object.assign(Object.assign({},state),{activeContainer:action.payload});case"CHANGE_CATEGORY":return Object.assign(Object.assign({},state),{items:state.items.map((item=>item.id===action.payload.itemId?Object.assign(Object.assign({},item),{container:action.payload.container}):item))});case"REORDER_ITEMS":{const{dragId:dragId,targetId:targetId}=action.payload;const newItems=[...state.items];const draggedItem=newItems.find((item=>item.id===dragId));const draggedIndex=newItems.indexOf(draggedItem);const targetIndex=newItems.findIndex((item=>item.id===targetId));newItems.splice(draggedIndex,1);newItems.splice(targetIndex,0,draggedItem);return Object.assign(Object.assign({},state),{items:newItems})}default:return state}};const DragContext=createContext({});const DraggableContext=()=>useContext(DragContext);const DraggableProvider=({children:children,initialItems:initialItems,onReorder:onReorder,onDragStart:onDragStart,onDragEnter:onDragEnter,onDragEnd:onDragEnd,onDrop:onDrop,onDragOver:onDragOver})=>{const[state,dispatch]=useReducer(reducer,initialState);useEffect((()=>{dispatch({type:"SET_ITEMS",payload:initialItems})}),[initialItems]);useEffect((()=>{onReorder(state.items)}),[state.items]);const handleDragStart=(id,container)=>{dispatch({type:"SET_DRAG_DATA",payload:{id:id,initialGroup:container}});dispatch({type:"SET_IS_DRAGGING",payload:id});if(onDragStart)onDragStart(id,container)};const handleDragEnter=(id,container)=>{if(state.dragData.id!==id){dispatch({type:"REORDER_ITEMS",payload:{dragId:state.dragData.id,targetId:id}});dispatch({type:"SET_DRAG_DATA",payload:{id:state.dragData.id,initialGroup:container}})}if(onDragEnter)onDragEnter(id,container)};const handleDragEnd=()=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});if(onDragEnd)onDragEnd()};const changeCategory=(itemId,container)=>{dispatch({type:"CHANGE_CATEGORY",payload:{itemId:itemId,container:container}})};const handleDrop=container=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});changeCategory(state.dragData.id,container);if(onDrop)onDrop(container)};const handleDragOver=(e,container)=>{e.preventDefault();dispatch({type:"SET_ACTIVE_CONTAINER",payload:container});if(onDragOver)onDragOver(e,container)};const contextValue=useMemo((()=>({items:state.items,dragData:state.dragData,isDragging:state.isDragging,activeContainer:state.activeContainer,handleDragStart:handleDragStart,handleDragEnter:handleDragEnter,handleDragEnd:handleDragEnd,handleDrop:handleDrop,handleDragOver:handleDragOver})),[state]);return jsx$1(DragContext.Provider,Object.assign({value:contextValue},{children:children}),void 0)};var classnames$1={exports:{}};
2
2
  /*!
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see