superdesk-ui-framework 3.0.14 → 3.0.15
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.
- package/.mocharc.json +5 -0
- package/app-typescript/components/ResizablePanels.tsx +98 -0
- package/app-typescript/components/WithPagination.tsx +231 -0
- package/app-typescript/components/with-pagination.spec.tsx +146 -0
- package/app-typescript/index.ts +2 -0
- package/dist/examples.bundle.js +2900 -1032
- package/dist/react/Index.tsx +11 -0
- package/dist/react/ResizablePanels.tsx +49 -0
- package/dist/react/WithPaginationDocs.tsx +57 -0
- package/dist/superdesk-ui.bundle.js +2498 -795
- package/dist/vendor.bundle.js +20 -20
- package/examples/pages/react/Index.tsx +11 -0
- package/examples/pages/react/ResizablePanels.tsx +49 -0
- package/examples/pages/react/WithPaginationDocs.tsx +57 -0
- package/mocha-setup.ts +5 -0
- package/package.json +15 -2
- package/react/components/ResizablePanels.d.ts +34 -0
- package/react/components/ResizablePanels.js +101 -0
- package/react/components/WithPagination.d.ts +26 -0
- package/react/components/WithPagination.js +191 -0
- package/react/index.d.ts +2 -0
- package/react/index.js +7 -2
- package/tsconfig.json +1 -1
- package/spec/scenarios.js +0 -13
package/dist/vendor.bundle.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
var a = typeof exports === 'object' ? factory(require("react"), require("react-dom")) : factory(root["react"], root["react-dom"]);
|
8
8
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
9
9
|
}
|
10
|
-
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__,
|
10
|
+
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_9__) {
|
11
11
|
return /******/ (function(modules) { // webpackBootstrap
|
12
12
|
/******/ // The module cache
|
13
13
|
/******/ var installedModules = {};
|
@@ -70,7 +70,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
70
70
|
/******/ __webpack_require__.p = "";
|
71
71
|
/******/
|
72
72
|
/******/ // Load entry module and return exports
|
73
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
73
|
+
/******/ return __webpack_require__(__webpack_require__.s = 553);
|
74
74
|
/******/ })
|
75
75
|
/************************************************************************/
|
76
76
|
/******/ ({
|
@@ -82,7 +82,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
|
|
82
82
|
|
83
83
|
/***/ }),
|
84
84
|
|
85
|
-
/***/
|
85
|
+
/***/ 33:
|
86
86
|
/***/ (function(module, exports, __webpack_require__) {
|
87
87
|
|
88
88
|
/* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
|
@@ -28246,29 +28246,29 @@ module.exports = function(module) {
|
|
28246
28246
|
|
28247
28247
|
/***/ }),
|
28248
28248
|
|
28249
|
-
/***/
|
28249
|
+
/***/ 553:
|
28250
28250
|
/***/ (function(module, exports, __webpack_require__) {
|
28251
28251
|
|
28252
28252
|
"use strict";
|
28253
28253
|
|
28254
28254
|
|
28255
|
-
__webpack_require__(
|
28255
|
+
__webpack_require__(33);
|
28256
28256
|
|
28257
28257
|
__webpack_require__(42);
|
28258
28258
|
|
28259
|
-
__webpack_require__(
|
28259
|
+
__webpack_require__(554);
|
28260
28260
|
|
28261
|
-
__webpack_require__(
|
28261
|
+
__webpack_require__(556);
|
28262
28262
|
|
28263
|
-
__webpack_require__(
|
28263
|
+
__webpack_require__(558);
|
28264
28264
|
|
28265
28265
|
__webpack_require__(0);
|
28266
28266
|
|
28267
|
-
__webpack_require__(
|
28267
|
+
__webpack_require__(9);
|
28268
28268
|
|
28269
28269
|
/***/ }),
|
28270
28270
|
|
28271
|
-
/***/
|
28271
|
+
/***/ 554:
|
28272
28272
|
/***/ (function(module, exports, __webpack_require__) {
|
28273
28273
|
|
28274
28274
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
@@ -28292,7 +28292,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
28292
28292
|
if ( true ) {
|
28293
28293
|
|
28294
28294
|
// AMD. Register as an anonymous module.
|
28295
|
-
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(42), __webpack_require__(
|
28295
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(42), __webpack_require__(555) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
28296
28296
|
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
28297
28297
|
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
28298
28298
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
@@ -29030,7 +29030,7 @@ return $.widget;
|
|
29030
29030
|
|
29031
29031
|
/***/ }),
|
29032
29032
|
|
29033
|
-
/***/
|
29033
|
+
/***/ 555:
|
29034
29034
|
/***/ (function(module, exports, __webpack_require__) {
|
29035
29035
|
|
29036
29036
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
|
@@ -29060,16 +29060,16 @@ return $.ui.version = "1.13.0";
|
|
29060
29060
|
|
29061
29061
|
/***/ }),
|
29062
29062
|
|
29063
|
-
/***/
|
29063
|
+
/***/ 556:
|
29064
29064
|
/***/ (function(module, exports, __webpack_require__) {
|
29065
29065
|
|
29066
|
-
__webpack_require__(
|
29066
|
+
__webpack_require__(557);
|
29067
29067
|
module.exports = angular;
|
29068
29068
|
|
29069
29069
|
|
29070
29070
|
/***/ }),
|
29071
29071
|
|
29072
|
-
/***/
|
29072
|
+
/***/ 557:
|
29073
29073
|
/***/ (function(module, exports, __webpack_require__) {
|
29074
29074
|
|
29075
29075
|
/* WEBPACK VAR INJECTION */(function(__webpack_provided_window_dot_jQuery) {/**
|
@@ -65676,16 +65676,16 @@ $provide.value("$locale", {
|
|
65676
65676
|
|
65677
65677
|
/***/ }),
|
65678
65678
|
|
65679
|
-
/***/
|
65679
|
+
/***/ 558:
|
65680
65680
|
/***/ (function(module, exports, __webpack_require__) {
|
65681
65681
|
|
65682
|
-
__webpack_require__(
|
65682
|
+
__webpack_require__(559);
|
65683
65683
|
module.exports = 'ngAnimate';
|
65684
65684
|
|
65685
65685
|
|
65686
65686
|
/***/ }),
|
65687
65687
|
|
65688
|
-
/***/
|
65688
|
+
/***/ 559:
|
65689
65689
|
/***/ (function(module, exports) {
|
65690
65690
|
|
65691
65691
|
/**
|
@@ -69964,10 +69964,10 @@ angular.module('ngAnimate', [], function initAngularHelpers() {
|
|
69964
69964
|
|
69965
69965
|
/***/ }),
|
69966
69966
|
|
69967
|
-
/***/
|
69967
|
+
/***/ 9:
|
69968
69968
|
/***/ (function(module, exports) {
|
69969
69969
|
|
69970
|
-
module.exports =
|
69970
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_9__;
|
69971
69971
|
|
69972
69972
|
/***/ })
|
69973
69973
|
|
@@ -62,9 +62,11 @@ import { SelectWithTemplateDocs } from './SelectWithTemplate';
|
|
62
62
|
import { MultiselectDocs } from './MultiSelect';
|
63
63
|
import { TreeSelectDocs } from './TreeSelect';
|
64
64
|
import DurationInputDoc from './DurationInput';
|
65
|
+
import {WithPaginationDocs} from './WithPaginationDocs';
|
65
66
|
import { PopoverDoc } from './Popover';
|
66
67
|
import { MenuDocs } from './Menu';
|
67
68
|
import {WithSizeObserverDocs} from './WithSizeObserver';
|
69
|
+
import {ResizablePanelsDoc} from './ResizablePanels';
|
68
70
|
|
69
71
|
const pages = {
|
70
72
|
basicComponents: {
|
@@ -166,6 +168,9 @@ const pages = {
|
|
166
168
|
"togglebox": {
|
167
169
|
name: "Togglebox"
|
168
170
|
},
|
171
|
+
"resizable-panels": {
|
172
|
+
name: "Resizable panels"
|
173
|
+
},
|
169
174
|
}
|
170
175
|
},
|
171
176
|
textComponents: {
|
@@ -200,6 +205,9 @@ const pages = {
|
|
200
205
|
'content-list': {
|
201
206
|
name: 'Content list'
|
202
207
|
},
|
208
|
+
'with-pagination': {
|
209
|
+
name: 'With pagination'
|
210
|
+
},
|
203
211
|
}
|
204
212
|
},
|
205
213
|
formComponents: {
|
@@ -342,6 +350,7 @@ class ReactDoc extends React.Component<IProps, IState> {
|
|
342
350
|
<Route path="/react/multiselect" component={MultiselectDocs} />
|
343
351
|
<Route path="/react/treeselect" component={TreeSelectDocs} />
|
344
352
|
<Route path="/react/duration-input" component={DurationInputDoc} />
|
353
|
+
<Route path="/react/with-pagination" component={WithPaginationDocs} />
|
345
354
|
<Route path="/react/popover" component={PopoverDoc} />
|
346
355
|
<Route path="/react/date-picker" component={DatePickerDoc} />
|
347
356
|
<Route path="/react/time-picker" component={TimePickerDoc} />
|
@@ -379,6 +388,7 @@ class ReactDoc extends React.Component<IProps, IState> {
|
|
379
388
|
<Route path="/react/container" component={ContainerDoc} />
|
380
389
|
<Route path="/react/dropzone" component={DropZoneDoc} />
|
381
390
|
<Route path="/react/create-button" component={CreateButtonDoc} />
|
391
|
+
<Route path="/react/resizable-panels" component={ResizablePanelsDoc} />
|
382
392
|
<Route path="/" component={ReactDefault} />
|
383
393
|
</Switch>
|
384
394
|
</main>
|
@@ -409,3 +419,4 @@ const parsePlayground = ({ match }, playgrounds) => {
|
|
409
419
|
};
|
410
420
|
|
411
421
|
export { ReactDoc, ReactPlayground };
|
422
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
|
3
|
+
import * as Markup from '../../js/react';
|
4
|
+
|
5
|
+
import {ResizablePanels} from '../../../app-typescript';
|
6
|
+
import {repeat} from 'lodash';
|
7
|
+
|
8
|
+
export class ResizablePanelsDoc extends React.Component {
|
9
|
+
render() {
|
10
|
+
return (
|
11
|
+
<section className='docs-page__container'>
|
12
|
+
|
13
|
+
<h2 className='docs-page__h2'>Resizable panels</h2>
|
14
|
+
|
15
|
+
<p className='docs-page__paragraph'></p>
|
16
|
+
<Markup.ReactMarkup>
|
17
|
+
<Markup.ReactMarkupPreview>
|
18
|
+
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
19
|
+
<div className='form__row'>
|
20
|
+
<ResizablePanels direction="horizontal" secondarySize={{default: 20}}>
|
21
|
+
<div>
|
22
|
+
{repeat('Lorem ipsum dolor sit amet ', 50)}
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div>
|
26
|
+
{repeat('Lorem ipsum dolor sit amet ', 50)}
|
27
|
+
</div>
|
28
|
+
</ResizablePanels>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
</Markup.ReactMarkupPreview>
|
33
|
+
|
34
|
+
<Markup.ReactMarkupCode>{`
|
35
|
+
<ResizablePanels direction="horizontal" secondarySize={{default: 20}}>
|
36
|
+
<div>
|
37
|
+
{repeat('Lorem ipsum dolor sit amet', 50)}
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div>
|
41
|
+
{repeat('Lorem ipsum dolor sit amet', 50)}
|
42
|
+
</div>
|
43
|
+
</ResizablePanels>
|
44
|
+
`}</Markup.ReactMarkupCode>
|
45
|
+
</Markup.ReactMarkup>
|
46
|
+
</section>
|
47
|
+
)
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
|
3
|
+
import * as Markup from '../../js/react';
|
4
|
+
|
5
|
+
import {WithPagination} from '../../../app-typescript';
|
6
|
+
import {range} from 'lodash';
|
7
|
+
|
8
|
+
function getItems(pageNo: number): Promise<{items: Array<number>, itemCount: number}> {
|
9
|
+
return new Promise((resolve) => {
|
10
|
+
setTimeout(() => {
|
11
|
+
return resolve({items: range(1, 500).slice((pageNo - 1) * 20, (pageNo - 1) * 20 + 20), itemCount: 500});
|
12
|
+
}, 1000);
|
13
|
+
});
|
14
|
+
};
|
15
|
+
|
16
|
+
export class WithPaginationDocs extends React.Component {
|
17
|
+
render() {
|
18
|
+
const wrapperStyle: React.CSSProperties = {
|
19
|
+
display: 'flex',
|
20
|
+
flexDirection: 'column',
|
21
|
+
alignItems: 'center'
|
22
|
+
};
|
23
|
+
|
24
|
+
return (
|
25
|
+
<section className='docs-page__container'>
|
26
|
+
<h2 className='docs-page__h2'>With pagination</h2>
|
27
|
+
<p className='docs-page__paragraph'></p>
|
28
|
+
<Markup.ReactMarkup>
|
29
|
+
<Markup.ReactMarkupPreview>
|
30
|
+
<WithPagination
|
31
|
+
getItems={(pageNo) => getItems(pageNo)}
|
32
|
+
>
|
33
|
+
{
|
34
|
+
(items) =>
|
35
|
+
<div style={wrapperStyle}>
|
36
|
+
{items.map((x, i) => <div key={i}>{x}</div>)}
|
37
|
+
</div>
|
38
|
+
}
|
39
|
+
</WithPagination>
|
40
|
+
</Markup.ReactMarkupPreview>
|
41
|
+
<Markup.ReactMarkupCode>{`
|
42
|
+
<WithPagination
|
43
|
+
getItems={(pageNo) => getItems(pageNo)}
|
44
|
+
>
|
45
|
+
{
|
46
|
+
(items) =>
|
47
|
+
<div style={wrapperStyle}>
|
48
|
+
{items.map((x, i) => <div key={i}>{x}</div>)}
|
49
|
+
</div>
|
50
|
+
}
|
51
|
+
</WithPagination>
|
52
|
+
`}</Markup.ReactMarkupCode>
|
53
|
+
</Markup.ReactMarkup>
|
54
|
+
</section>
|
55
|
+
)
|
56
|
+
}
|
57
|
+
}
|
package/mocha-setup.ts
ADDED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "superdesk-ui-framework",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.15",
|
4
4
|
"license": "AGPL-3.0",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -23,12 +23,17 @@
|
|
23
23
|
"build-ui": "webpack && tsc && npm run lint",
|
24
24
|
"lint": "eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}'",
|
25
25
|
"lint-fix": "tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'",
|
26
|
-
"prepublishOnly": "npm run build"
|
26
|
+
"prepublishOnly": "npm run build",
|
27
|
+
"unit-test": "mocha",
|
28
|
+
"debug-unit-tests": "mocha --inspect-brk"
|
27
29
|
},
|
28
30
|
"devDependencies": {
|
31
|
+
"@types/assert": "^1.5.6",
|
29
32
|
"@types/chart.js": "^2.9.24",
|
30
33
|
"@types/classnames": "^2.2.9",
|
34
|
+
"@types/enzyme": "^3.10.12",
|
31
35
|
"@types/lodash": "^4.14.161",
|
36
|
+
"@types/mocha": "^9.1.1",
|
32
37
|
"@types/react": "16.8.23",
|
33
38
|
"@types/react-beautiful-dnd": "^13.1.2",
|
34
39
|
"@types/react-dom": "16.8.0",
|
@@ -58,7 +63,10 @@
|
|
58
63
|
"html-webpack-plugin": "^2.30.1",
|
59
64
|
"jquery": "^3.1.1",
|
60
65
|
"jquery-ui": "^1.12.1",
|
66
|
+
"jsdom": "20.0.3",
|
67
|
+
"jsdom-global": "3.0.2",
|
61
68
|
"lodash": "4.17.21",
|
69
|
+
"mocha": "^8.4.0",
|
62
70
|
"node-sass": "6.0",
|
63
71
|
"prismjs": "^1.28.0",
|
64
72
|
"prop-types": "^15.6.0",
|
@@ -73,6 +81,7 @@
|
|
73
81
|
"style-loader": "^0.18.2",
|
74
82
|
"superdesk-code-style": "^1.1.2",
|
75
83
|
"ts-loader": "^6.0.2",
|
84
|
+
"ts-node": "^10.9.1",
|
76
85
|
"tslint": "^5.18.0",
|
77
86
|
"typescript": "4.9.5",
|
78
87
|
"url-loader": "^1.1.2",
|
@@ -85,9 +94,13 @@
|
|
85
94
|
"@material-ui/lab": "^4.0.0-alpha.56",
|
86
95
|
"@popperjs/core": "^2.4.0",
|
87
96
|
"@superdesk/primereact": "^5.0.2-10",
|
97
|
+
"@superdesk/react-resizable-panels": "0.0.39",
|
98
|
+
"@types/enzyme-adapter-react-16": "^1.0.6",
|
88
99
|
"@types/node": "^14.10.2",
|
89
100
|
"chart.js": "^2.9.3",
|
90
101
|
"date-fns": "2.7.0",
|
102
|
+
"enzyme": "^3.11.0",
|
103
|
+
"enzyme-adapter-react-16": "^1.15.7",
|
91
104
|
"moment": "^2.29.3",
|
92
105
|
"popper.js": "1.14.4",
|
93
106
|
"primeicons": "2.0.0",
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface IPanelSize {
|
3
|
+
min?: number;
|
4
|
+
max?: number;
|
5
|
+
default?: number;
|
6
|
+
}
|
7
|
+
interface IProps {
|
8
|
+
/**
|
9
|
+
* component will set primary dimension(width when horizontal, height when vertical) to 100%
|
10
|
+
* parent component has to support this
|
11
|
+
*/
|
12
|
+
direction: 'horizontal' | 'vertical';
|
13
|
+
primarySize?: IPanelSize;
|
14
|
+
secondarySize?: IPanelSize;
|
15
|
+
/**
|
16
|
+
* Only 2 items are supported to keep API surface minimal so it's easy to switch to another library if needed.
|
17
|
+
*/
|
18
|
+
children: [React.ReactNode, React.ReactNode];
|
19
|
+
}
|
20
|
+
/**
|
21
|
+
Features:
|
22
|
+
* No absolute positioning is used
|
23
|
+
* Component height is fully dynamic and adjusts according to children inside panes
|
24
|
+
* Library supports an arbitrary number of panes. We are not using it to keep API minimal.
|
25
|
+
* Drawback: only works with percent units. Can be made to work with pixels
|
26
|
+
* by creating a wrapper that measures available space and converts to percent.
|
27
|
+
*/
|
28
|
+
export declare class ResizablePanels extends React.PureComponent<IProps> {
|
29
|
+
private primaryPanelRef;
|
30
|
+
private secondaryPanelRef;
|
31
|
+
constructor(props: IProps);
|
32
|
+
render(): React.ReactNode;
|
33
|
+
}
|
34
|
+
export {};
|
@@ -0,0 +1,101 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
18
|
+
__assign = Object.assign || function(t) {
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
+
s = arguments[i];
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
+
t[p] = s[p];
|
23
|
+
}
|
24
|
+
return t;
|
25
|
+
};
|
26
|
+
return __assign.apply(this, arguments);
|
27
|
+
};
|
28
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
29
|
+
if (k2 === undefined) k2 = k;
|
30
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
31
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
32
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
33
|
+
}
|
34
|
+
Object.defineProperty(o, k2, desc);
|
35
|
+
}) : (function(o, m, k, k2) {
|
36
|
+
if (k2 === undefined) k2 = k;
|
37
|
+
o[k2] = m[k];
|
38
|
+
}));
|
39
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
40
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
41
|
+
}) : function(o, v) {
|
42
|
+
o["default"] = v;
|
43
|
+
});
|
44
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
45
|
+
if (mod && mod.__esModule) return mod;
|
46
|
+
var result = {};
|
47
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
48
|
+
__setModuleDefault(result, mod);
|
49
|
+
return result;
|
50
|
+
};
|
51
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
52
|
+
exports.ResizablePanels = void 0;
|
53
|
+
var React = __importStar(require("react"));
|
54
|
+
var react_resizable_panels_1 = require("@superdesk/react-resizable-panels");
|
55
|
+
/**
|
56
|
+
Features:
|
57
|
+
* No absolute positioning is used
|
58
|
+
* Component height is fully dynamic and adjusts according to children inside panes
|
59
|
+
* Library supports an arbitrary number of panes. We are not using it to keep API minimal.
|
60
|
+
* Drawback: only works with percent units. Can be made to work with pixels
|
61
|
+
* by creating a wrapper that measures available space and converts to percent.
|
62
|
+
*/
|
63
|
+
var ResizablePanels = /** @class */ (function (_super) {
|
64
|
+
__extends(ResizablePanels, _super);
|
65
|
+
function ResizablePanels(props) {
|
66
|
+
var _this = _super.call(this, props) || this;
|
67
|
+
_this.primaryPanelRef = null;
|
68
|
+
_this.secondaryPanelRef = null;
|
69
|
+
return _this;
|
70
|
+
}
|
71
|
+
ResizablePanels.prototype.render = function () {
|
72
|
+
var _this = this;
|
73
|
+
var _a = this.props, direction = _a.direction, primarySize = _a.primarySize, secondarySize = _a.secondarySize, children = _a.children;
|
74
|
+
var separatorDimensions = direction === 'horizontal'
|
75
|
+
? { width: 3, height: '100%' }
|
76
|
+
: { height: 3, width: '100%' };
|
77
|
+
// Sometimes second panel is conditional. Checking here is more convenient.
|
78
|
+
if (children.some(function (child) { return child === false || child == null; })) {
|
79
|
+
return children;
|
80
|
+
}
|
81
|
+
return (React.createElement(react_resizable_panels_1.PanelGroup, { direction: direction },
|
82
|
+
React.createElement(react_resizable_panels_1.Panel, { id: "primary", minSize: primarySize === null || primarySize === void 0 ? void 0 : primarySize.min, maxSize: primarySize === null || primarySize === void 0 ? void 0 : primarySize.max, defaultSize: primarySize === null || primarySize === void 0 ? void 0 : primarySize.default, ref: function (panelRef) {
|
83
|
+
_this.primaryPanelRef = panelRef;
|
84
|
+
} }, children[0]),
|
85
|
+
React.createElement(react_resizable_panels_1.PanelResizeHandle, null,
|
86
|
+
React.createElement("div", { style: __assign({ background: 'var(--color-text-lighter)' }, separatorDimensions), onDoubleClick: function () {
|
87
|
+
var _a, _b;
|
88
|
+
if ((primarySize === null || primarySize === void 0 ? void 0 : primarySize.default) != null) {
|
89
|
+
(_a = _this.primaryPanelRef) === null || _a === void 0 ? void 0 : _a.resize(primarySize.default);
|
90
|
+
}
|
91
|
+
else if ((secondarySize === null || secondarySize === void 0 ? void 0 : secondarySize.default) != null) {
|
92
|
+
(_b = _this.secondaryPanelRef) === null || _b === void 0 ? void 0 : _b.resize(secondarySize.default);
|
93
|
+
}
|
94
|
+
} })),
|
95
|
+
React.createElement(react_resizable_panels_1.Panel, { id: "secondary", minSize: secondarySize === null || secondarySize === void 0 ? void 0 : secondarySize.min, maxSize: secondarySize === null || secondarySize === void 0 ? void 0 : secondarySize.max, defaultSize: secondarySize === null || secondarySize === void 0 ? void 0 : secondarySize.default, ref: function (panelRef) {
|
96
|
+
_this.secondaryPanelRef = panelRef;
|
97
|
+
} }, children[1])));
|
98
|
+
};
|
99
|
+
return ResizablePanels;
|
100
|
+
}(React.PureComponent));
|
101
|
+
exports.ResizablePanels = ResizablePanels;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface IProps<T> {
|
3
|
+
getItems(pageNo: number, signal: AbortSignal): Promise<{
|
4
|
+
items: Array<T>;
|
5
|
+
itemCount: number;
|
6
|
+
}>;
|
7
|
+
children: (items: Array<T>) => JSX.Element;
|
8
|
+
pageSize?: number;
|
9
|
+
}
|
10
|
+
interface IState<T> {
|
11
|
+
currentPage: number;
|
12
|
+
items: Array<T> | null;
|
13
|
+
}
|
14
|
+
export declare function getPagination(currentPage: number, totalPages: number): Array<number | 'dots'>;
|
15
|
+
export declare class WithPagination<T> extends React.PureComponent<IProps<T>, IState<T>> {
|
16
|
+
private pageCount;
|
17
|
+
private abortController;
|
18
|
+
private ref;
|
19
|
+
private inProgress;
|
20
|
+
constructor(props: IProps<T>);
|
21
|
+
getPageSize(): number;
|
22
|
+
switchPage(page: number): void;
|
23
|
+
componentDidMount(): void;
|
24
|
+
render(): JSX.Element | null;
|
25
|
+
}
|
26
|
+
export {};
|