dinocollab-core 1.0.3 → 1.0.4
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/dist/_virtual/_rollupPluginBabelHelpers.js +1 -487
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/dist/api-context/alert-global.js +1 -165
- package/dist/api-context/alert-global.js.map +1 -1
- package/dist/api-context/drawer-global.js +1 -111
- package/dist/api-context/drawer-global.js.map +1 -1
- package/dist/api-context/global-modal.js +1 -94
- package/dist/api-context/global-modal.js.map +1 -1
- package/dist/api-context/popover-global.js +1 -109
- package/dist/api-context/popover-global.js.map +1 -1
- package/dist/api-context/popover.js +1 -93
- package/dist/api-context/popover.js.map +1 -1
- package/dist/api-context/ui.units.js +1 -22
- package/dist/api-context/ui.units.js.map +1 -1
- package/dist/components/breadcrumbs.js +1 -64
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/copy-to-clipboard.js +1 -111
- package/dist/components/copy-to-clipboard.js.map +1 -1
- package/dist/components/help-tooltip.js +1 -103
- package/dist/components/help-tooltip.js.map +1 -1
- package/dist/components/image-with-fallback.js +1 -50
- package/dist/components/image-with-fallback.js.map +1 -1
- package/dist/components/text-editor.js +1 -117
- package/dist/components/text-editor.js.map +1 -1
- package/dist/components/text-editor.preview.js +1 -26
- package/dist/components/text-editor.preview.js.map +1 -1
- package/dist/form/create.autocomplete.chips.js +1 -227
- package/dist/form/create.autocomplete.chips.js.map +1 -1
- package/dist/form/create.date-expired.js +1 -210
- package/dist/form/create.date-expired.js.map +1 -1
- package/dist/form/create.date-picker.js +1 -127
- package/dist/form/create.date-picker.js.map +1 -1
- package/dist/form/create.form-base.js +1 -140
- package/dist/form/create.form-base.js.map +1 -1
- package/dist/form/create.form-comfirm.js +1 -130
- package/dist/form/create.form-comfirm.js.map +1 -1
- package/dist/form/create.form-grid-layout.js +1 -187
- package/dist/form/create.form-grid-layout.js.map +1 -1
- package/dist/form/create.form-grid-layout.units.js +1 -41
- package/dist/form/create.form-grid-layout.units.js.map +1 -1
- package/dist/form/create.input.file.js +1 -78
- package/dist/form/create.input.file.js.map +1 -1
- package/dist/form/create.input.js +1 -275
- package/dist/form/create.input.js.map +1 -1
- package/dist/form/create.select-simple.js +1 -113
- package/dist/form/create.select-simple.js.map +1 -1
- package/dist/form/create.select-with-api.js +1 -276
- package/dist/form/create.select-with-api.js.map +1 -1
- package/dist/form/create.text-editor.js +1 -180
- package/dist/form/create.text-editor.js.map +1 -1
- package/dist/form/dino-form.js +1 -40
- package/dist/form/dino-form.js.map +1 -1
- package/dist/form/helper.js +1 -156
- package/dist/form/helper.js.map +1 -1
- package/dist/form/modal-wrapper.js +1 -81
- package/dist/form/modal-wrapper.js.map +1 -1
- package/dist/form/validator.js +1 -189
- package/dist/form/validator.js.map +1 -1
- package/dist/hooks/index.js +1 -47
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.js +1 -32
- package/dist/index.js.map +1 -1
- package/dist/redux/create.hoc-lazy.js +1 -70
- package/dist/redux/create.hoc-lazy.js.map +1 -1
- package/dist/redux/dino.js +1 -10
- package/dist/redux/dino.js.map +1 -1
- package/dist/redux/types.js +1 -8
- package/dist/redux/types.js.map +1 -1
- package/dist/redux/ui.error-page.js +1 -88
- package/dist/redux/ui.error-page.js.map +1 -1
- package/dist/redux/vector-404.webp.js +1 -3
- package/dist/redux/vector-404.webp.js.map +1 -1
- package/dist/table/context.js +1 -14
- package/dist/table/context.js.map +1 -1
- package/dist/table/create.action-row.js +1 -143
- package/dist/table/create.action-row.js.map +1 -1
- package/dist/table/create.table.js +1 -245
- package/dist/table/create.table.js.map +1 -1
- package/dist/table/custom.filter-operators.js +1 -88
- package/dist/table/custom.filter-operators.js.map +1 -1
- package/dist/table/dino.js +1 -135
- package/dist/table/dino.js.map +1 -1
- package/dist/table/helpers.js +1 -114
- package/dist/table/helpers.js.map +1 -1
- package/dist/table/model-filter.js +1 -22
- package/dist/table/model-filter.js.map +1 -1
- package/dist/table/toolbar-pannel.js +1 -142
- package/dist/table/toolbar-pannel.js.map +1 -1
- package/dist/table/ui.buttons.js +1 -66
- package/dist/table/ui.buttons.js.map +1 -1
- package/dist/table/ui.units.js +1 -247
- package/dist/table/ui.units.js.map +1 -1
- package/dist/utils/dayjs-config.js +1 -11
- package/dist/utils/dayjs-config.js.map +1 -1
- package/dist/utils/helpers.js +1 -198
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/json-object.js +1 -37
- package/dist/utils/json-object.js.map +1 -1
- package/dist/utils/query-param.js +1 -171
- package/dist/utils/query-param.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
var ELogic;
|
|
2
|
-
(function (ELogic) {
|
|
3
|
-
ELogic[ELogic["And"] = 0] = "And";
|
|
4
|
-
ELogic[ELogic["Or"] = 1] = "Or";
|
|
5
|
-
})(ELogic || (ELogic = {}));
|
|
6
|
-
var EOperator;
|
|
7
|
-
(function (EOperator) {
|
|
8
|
-
EOperator[EOperator["GreaterThan"] = 0] = "GreaterThan";
|
|
9
|
-
EOperator[EOperator["LessThan"] = 1] = "LessThan";
|
|
10
|
-
EOperator[EOperator["GreaterThanOrEqual"] = 2] = "GreaterThanOrEqual";
|
|
11
|
-
EOperator[EOperator["LessThanOrEqual"] = 3] = "LessThanOrEqual";
|
|
12
|
-
EOperator[EOperator["NotEqual"] = 4] = "NotEqual";
|
|
13
|
-
EOperator[EOperator["Equal"] = 5] = "Equal";
|
|
14
|
-
EOperator[EOperator["Contains"] = 6] = "Contains";
|
|
15
|
-
})(EOperator || (EOperator = {}));
|
|
16
|
-
var EOrder;
|
|
17
|
-
(function (EOrder) {
|
|
18
|
-
EOrder[EOrder["Ascending"] = 0] = "Ascending";
|
|
19
|
-
EOrder[EOrder["Descending"] = 1] = "Descending";
|
|
20
|
-
})(EOrder || (EOrder = {}));
|
|
21
|
-
|
|
22
|
-
export { ELogic, EOperator, EOrder };
|
|
1
|
+
var n,a,e;!function(n){n[n.And=0]="And",n[n.Or=1]="Or"}(n||(n={})),function(n){n[n.GreaterThan=0]="GreaterThan",n[n.LessThan=1]="LessThan",n[n.GreaterThanOrEqual=2]="GreaterThanOrEqual",n[n.LessThanOrEqual=3]="LessThanOrEqual",n[n.NotEqual=4]="NotEqual",n[n.Equal=5]="Equal",n[n.Contains=6]="Contains"}(a||(a={})),function(n){n[n.Ascending=0]="Ascending",n[n.Descending=1]="Descending"}(e||(e={}));export{n as ELogic,a as EOperator,e as EOrder};
|
|
23
2
|
//# sourceMappingURL=model-filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-filter.js","sources":["../../src/table/model-filter.ts"],"sourcesContent":["export enum ELogic {\r\n And,\r\n Or\r\n}\r\n\r\nexport enum EOperator {\r\n GreaterThan,\r\n LessThan,\r\n GreaterThanOrEqual,\r\n LessThanOrEqual,\r\n NotEqual,\r\n Equal,\r\n Contains\r\n}\r\n\r\nexport enum EOrder {\r\n Ascending,\r\n Descending\r\n}\r\n\r\nexport interface IFieldFilter<T> {\r\n Logic?: ELogic\r\n Operator?: EOperator\r\n FieldName: keyof T\r\n Value: string\r\n}\r\n\r\nexport interface IScopeFilter<T> {\r\n Logic?: ELogic\r\n Scopes: IPropFilter<T>[]\r\n}\r\n\r\nexport type IPropFilter<T> = IFieldFilter<T> | IScopeFilter<T>\r\n\r\nexport interface IPropOrderBy<T> {\r\n Type: EOrder\r\n FieldName: keyof T\r\n}\r\n\r\nexport interface IModelFilter<T> {\r\n Page?: number\r\n Amount?: number\r\n PropFilters?: IPropFilter<T>[]\r\n PropOrders?: IPropOrderBy<T>[]\r\n}\r\n"],"names":["ELogic","EOperator","EOrder"],"mappings":"IAAYA
|
|
1
|
+
{"version":3,"file":"model-filter.js","sources":["../../src/table/model-filter.ts"],"sourcesContent":["export enum ELogic {\r\n And,\r\n Or\r\n}\r\n\r\nexport enum EOperator {\r\n GreaterThan,\r\n LessThan,\r\n GreaterThanOrEqual,\r\n LessThanOrEqual,\r\n NotEqual,\r\n Equal,\r\n Contains\r\n}\r\n\r\nexport enum EOrder {\r\n Ascending,\r\n Descending\r\n}\r\n\r\nexport interface IFieldFilter<T> {\r\n Logic?: ELogic\r\n Operator?: EOperator\r\n FieldName: keyof T\r\n Value: string\r\n}\r\n\r\nexport interface IScopeFilter<T> {\r\n Logic?: ELogic\r\n Scopes: IPropFilter<T>[]\r\n}\r\n\r\nexport type IPropFilter<T> = IFieldFilter<T> | IScopeFilter<T>\r\n\r\nexport interface IPropOrderBy<T> {\r\n Type: EOrder\r\n FieldName: keyof T\r\n}\r\n\r\nexport interface IModelFilter<T> {\r\n Page?: number\r\n Amount?: number\r\n PropFilters?: IPropFilter<T>[]\r\n PropOrders?: IPropOrderBy<T>[]\r\n}\r\n"],"names":["ELogic","EOperator","EOrder"],"mappings":"IAAYA,EAKAC,EAUAC,GAfZ,SAAYF,GACVA,EAAAA,EAAA,IAAA,GAAA,MACAA,EAAAA,EAAA,GAAA,GAAA,IACD,CAHD,CAAYA,IAAAA,EAGX,CAAA,IAED,SAAYC,GACVA,EAAAA,EAAA,YAAA,GAAA,cACAA,EAAAA,EAAA,SAAA,GAAA,WACAA,EAAAA,EAAA,mBAAA,GAAA,qBACAA,EAAAA,EAAA,gBAAA,GAAA,kBACAA,EAAAA,EAAA,SAAA,GAAA,WACAA,EAAAA,EAAA,MAAA,GAAA,QACAA,EAAAA,EAAA,SAAA,GAAA,UACD,CARD,CAAYA,IAAAA,EAQX,CAAA,IAED,SAAYC,GACVA,EAAAA,EAAA,UAAA,GAAA,YACAA,EAAAA,EAAA,WAAA,GAAA,YACD,CAHD,CAAYA,IAAAA,EAGX,CAAA"}
|
|
@@ -1,143 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { Component } from 'react';
|
|
4
|
-
import { GridToolbar, GridToolbarQuickFilter } from '@mui/x-data-grid';
|
|
5
|
-
import { styled, Typography, Box } from '@mui/material';
|
|
6
|
-
import { BtnFormCreate } from './ui.buttons.js';
|
|
7
|
-
import Breadcrumbs from '../components/breadcrumbs.js';
|
|
8
|
-
import 'clipboard-copy';
|
|
9
|
-
import '@mui/icons-material/Done';
|
|
10
|
-
import '@mui/icons-material/ContentCopy';
|
|
11
|
-
import HelpTooltip from '../components/help-tooltip.js';
|
|
12
|
-
import '../components/text-editor.js';
|
|
13
|
-
|
|
14
|
-
var ToolbarPannel = /*#__PURE__*/function (_Component) {
|
|
15
|
-
function ToolbarPannel() {
|
|
16
|
-
var _this;
|
|
17
|
-
_classCallCheck(this, ToolbarPannel);
|
|
18
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
|
-
args[_key] = arguments[_key];
|
|
20
|
-
}
|
|
21
|
-
_this = _callSuper(this, ToolbarPannel, [].concat(args));
|
|
22
|
-
_defineProperty(_this, "renderTitle", function () {
|
|
23
|
-
var _this$props = _this.props,
|
|
24
|
-
title = _this$props.title,
|
|
25
|
-
afterTitle = _this$props.afterTitle,
|
|
26
|
-
breadcrumbs = _this$props.breadcrumbs;
|
|
27
|
-
var isVisible = !!title || !!breadcrumbs || !!afterTitle;
|
|
28
|
-
if (!isVisible) return jsx(Fragment, {});
|
|
29
|
-
var titleElm = title;
|
|
30
|
-
if (typeof title === 'string') titleElm = jsx(Title, {
|
|
31
|
-
children: title
|
|
32
|
-
});
|
|
33
|
-
if (breadcrumbs) titleElm = jsx(Breadcrumbs, {
|
|
34
|
-
value: breadcrumbs
|
|
35
|
-
});
|
|
36
|
-
return jsxs(Box, {
|
|
37
|
-
sx: {
|
|
38
|
-
height: '56px',
|
|
39
|
-
display: 'flex',
|
|
40
|
-
alignItems: 'center'
|
|
41
|
-
},
|
|
42
|
-
children: [titleElm, afterTitle]
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
_defineProperty(_this, "renderEndAdornment", function () {
|
|
46
|
-
if (!_this.props.searchInclude || _this.props.searchInclude.length <= 0) return jsx(Fragment, {});
|
|
47
|
-
return jsx(HelpTooltip, {
|
|
48
|
-
title: 'The search includes',
|
|
49
|
-
small: true,
|
|
50
|
-
children: jsx(SeachHelp, {
|
|
51
|
-
children: _this.props.searchInclude.map(function (item, index) {
|
|
52
|
-
return jsx("li", {
|
|
53
|
-
children: jsx(Typography, {
|
|
54
|
-
variant: 'body2',
|
|
55
|
-
children: item
|
|
56
|
-
})
|
|
57
|
-
}, index);
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
return _this;
|
|
63
|
-
}
|
|
64
|
-
_inherits(ToolbarPannel, _Component);
|
|
65
|
-
return _createClass(ToolbarPannel, [{
|
|
66
|
-
key: "render",
|
|
67
|
-
value: function render() {
|
|
68
|
-
return jsxs(Box, {
|
|
69
|
-
sx: {
|
|
70
|
-
padding: '0 6px'
|
|
71
|
-
},
|
|
72
|
-
children: [this.renderTitle(), jsxs(Box, {
|
|
73
|
-
sx: {
|
|
74
|
-
display: 'flex'
|
|
75
|
-
},
|
|
76
|
-
children: [jsxs(Box, {
|
|
77
|
-
sx: {
|
|
78
|
-
flex: 1,
|
|
79
|
-
display: 'flex',
|
|
80
|
-
alignItems: 'center',
|
|
81
|
-
flexWrap: 'wrap'
|
|
82
|
-
},
|
|
83
|
-
children: [jsx(GridToolbar, {
|
|
84
|
-
sx: {
|
|
85
|
-
padding: 0
|
|
86
|
-
}
|
|
87
|
-
}), this.props.formCreate && jsx(BtnFormCreate, {
|
|
88
|
-
children: this.props.formCreate
|
|
89
|
-
}), this.props.afterAction]
|
|
90
|
-
}), jsx(Box, {
|
|
91
|
-
sx: {
|
|
92
|
-
display: 'flex',
|
|
93
|
-
gap: '8px',
|
|
94
|
-
alignItems: 'center'
|
|
95
|
-
},
|
|
96
|
-
children: jsxs(Box, {
|
|
97
|
-
sx: {
|
|
98
|
-
display: 'flex',
|
|
99
|
-
alignItems: 'center'
|
|
100
|
-
},
|
|
101
|
-
children: [jsx(GridToolbarQuickFilter, {
|
|
102
|
-
fullWidth: true,
|
|
103
|
-
variant: 'standard',
|
|
104
|
-
size: 'small',
|
|
105
|
-
debounceMs: 800,
|
|
106
|
-
quickFilterParser: function quickFilterParser(x) {
|
|
107
|
-
return [x];
|
|
108
|
-
}
|
|
109
|
-
}), this.renderEndAdornment()]
|
|
110
|
-
})
|
|
111
|
-
})]
|
|
112
|
-
})]
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}]);
|
|
116
|
-
}(Component);
|
|
117
|
-
var SeachHelp = styled('ul')({
|
|
118
|
-
margin: '0 0 0 18px',
|
|
119
|
-
padding: 0,
|
|
120
|
-
li: {
|
|
121
|
-
position: 'relative'
|
|
122
|
-
},
|
|
123
|
-
'li::after': {
|
|
124
|
-
content: '"►"',
|
|
125
|
-
display: 'inline-block',
|
|
126
|
-
top: '50%',
|
|
127
|
-
transform: 'translateY(-50%)',
|
|
128
|
-
position: 'absolute',
|
|
129
|
-
left: '-18px'
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
var Title = styled(function (props) {
|
|
133
|
-
return jsx(Typography, _objectSpread2({
|
|
134
|
-
noWrap: true,
|
|
135
|
-
variant: 'subtitle1'
|
|
136
|
-
}, props));
|
|
137
|
-
})({
|
|
138
|
-
fontWeight: 700,
|
|
139
|
-
flex: 1
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
export { ToolbarPannel as default };
|
|
1
|
+
import{objectSpread2 as r,inherits as e,createClass as t,classCallCheck as i,callSuper as n,defineProperty as a}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as l,jsxs as o,Fragment as s}from"react/jsx-runtime";import{Component as p}from"react";import{GridToolbar as c,GridToolbarQuickFilter as d}from"@mui/x-data-grid";import{styled as m,Typography as u,Box as f}from"@mui/material";import{BtnFormCreate as h}from"./ui.buttons.js";import x from"../components/breadcrumbs.js";import"clipboard-copy";import"@mui/icons-material/Done";import"@mui/icons-material/ContentCopy";import g from"../components/help-tooltip.js";import"../components/text-editor.js";var b=function(){function r(){var e;i(this,r);for(var t=arguments.length,p=new Array(t),c=0;c<t;c++)p[c]=arguments[c];return e=n(this,r,[].concat(p)),a(e,"renderTitle",(function(){var r=e.props,t=r.title,i=r.afterTitle,n=r.breadcrumbs;if(!(!!t||!!n||!!i))return l(s,{});var a=t;return"string"==typeof t&&(a=l(v,{children:t})),n&&(a=l(x,{value:n})),o(f,{sx:{height:"56px",display:"flex",alignItems:"center"},children:[a,i]})})),a(e,"renderEndAdornment",(function(){return!e.props.searchInclude||e.props.searchInclude.length<=0?l(s,{}):l(g,{title:"The search includes",small:!0,children:l(y,{children:e.props.searchInclude.map((function(r,e){return l("li",{children:l(u,{variant:"body2",children:r})},e)}))})})})),e}return e(r,p),t(r,[{key:"render",value:function(){return o(f,{sx:{padding:"0 6px"},children:[this.renderTitle(),o(f,{sx:{display:"flex"},children:[o(f,{sx:{flex:1,display:"flex",alignItems:"center",flexWrap:"wrap"},children:[l(c,{sx:{padding:0}}),this.props.formCreate&&l(h,{children:this.props.formCreate}),this.props.afterAction]}),l(f,{sx:{display:"flex",gap:"8px",alignItems:"center"},children:o(f,{sx:{display:"flex",alignItems:"center"},children:[l(d,{fullWidth:!0,variant:"standard",size:"small",debounceMs:800,quickFilterParser:function(r){return[r]}}),this.renderEndAdornment()]})})]})]})}}])}(),y=m("ul")({margin:"0 0 0 18px",padding:0,li:{position:"relative"},"li::after":{content:'"►"',display:"inline-block",top:"50%",transform:"translateY(-50%)",position:"absolute",left:"-18px"}}),v=m((function(e){return l(u,r({noWrap:!0,variant:"subtitle1"},e))}))({fontWeight:700,flex:1});export{b as default};
|
|
143
2
|
//# sourceMappingURL=toolbar-pannel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar-pannel.js","sources":["../../src/table/toolbar-pannel.tsx"],"sourcesContent":["import React, { Component } from 'react'\r\nimport { GridToolbar, GridToolbarQuickFilter } from '@mui/x-data-grid'\r\nimport { Box, styled, Typography, TypographyProps } from '@mui/material'\r\nimport { BtnFormCreate } from './ui.buttons'\r\nimport { Breadcrumbs, IBreadcrumbConfig, HelpTooltip } from '../components'\r\n\r\nexport interface IToolbarPannelOptions {\r\n searchInclude?: string[]\r\n formCreate?: React.ReactNode\r\n afterAction?: React.ReactNode\r\n breadcrumbs?: IBreadcrumbConfig[]\r\n}\r\n\r\nexport interface IToolbarPannelProps extends IToolbarPannelOptions {\r\n title?: React.ReactNode\r\n afterTitle?: React.ReactNode\r\n}\r\n\r\nclass ToolbarPannel extends Component<React.PropsWithChildren<IToolbarPannelProps>> {\r\n render() {\r\n return (\r\n <Box sx={{ padding: '0 6px' }}>\r\n {this.renderTitle()}\r\n <Box sx={{ display: 'flex' }}>\r\n <Box sx={{ flex: 1, display: 'flex', alignItems: 'center', flexWrap: 'wrap' }}>\r\n <GridToolbar sx={{ padding: 0 }} />\r\n {this.props.formCreate && <BtnFormCreate>{this.props.formCreate}</BtnFormCreate>}\r\n {this.props.afterAction}\r\n </Box>\r\n <Box sx={{ display: 'flex', gap: '8px', alignItems: 'center' }}>\r\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\r\n <GridToolbarQuickFilter fullWidth variant='standard' size='small' debounceMs={800} quickFilterParser={(x: any) => [x]} />\r\n {this.renderEndAdornment()}\r\n </Box>\r\n </Box>\r\n </Box>\r\n </Box>\r\n )\r\n }\r\n\r\n renderTitle = () => {\r\n const { title, afterTitle, breadcrumbs } = this.props\r\n\r\n const isVisible = !!title || !!breadcrumbs || !!afterTitle\r\n if (!isVisible) return <></>\r\n\r\n let titleElm = title\r\n if (typeof title === 'string') titleElm = <Title>{title}</Title>\r\n if (breadcrumbs) titleElm = <Breadcrumbs value={breadcrumbs} />\r\n\r\n return (\r\n <Box sx={{ height: '56px', display: 'flex', alignItems: 'center' }}>\r\n {titleElm}\r\n {afterTitle}\r\n </Box>\r\n )\r\n }\r\n\r\n renderEndAdornment = () => {\r\n if (!this.props.searchInclude || this.props.searchInclude.length <= 0) return <></>\r\n return (\r\n <HelpTooltip title='The search includes' small>\r\n <SeachHelp>\r\n {this.props.searchInclude.map((item, index) => (\r\n <li key={index}>\r\n <Typography variant='body2'>{item}</Typography>\r\n </li>\r\n ))}\r\n </SeachHelp>\r\n </HelpTooltip>\r\n )\r\n }\r\n}\r\n\r\nexport default ToolbarPannel\r\n\r\nconst SeachHelp = styled('ul')({\r\n margin: '0 0 0 18px',\r\n padding: 0,\r\n li: {\r\n position: 'relative'\r\n },\r\n 'li::after': {\r\n content: '\"►\"',\r\n display: 'inline-block',\r\n top: '50%',\r\n transform: 'translateY(-50%)',\r\n position: 'absolute',\r\n left: '-18px'\r\n }\r\n})\r\n\r\nconst Title = styled((props: TypographyProps) => <Typography noWrap variant='subtitle1' {...props} />)({\r\n fontWeight: 700,\r\n flex: 1\r\n})\r\n"],"names":["ToolbarPannel","
|
|
1
|
+
{"version":3,"file":"toolbar-pannel.js","sources":["../../src/table/toolbar-pannel.tsx"],"sourcesContent":["import React, { Component } from 'react'\r\nimport { GridToolbar, GridToolbarQuickFilter } from '@mui/x-data-grid'\r\nimport { Box, styled, Typography, TypographyProps } from '@mui/material'\r\nimport { BtnFormCreate } from './ui.buttons'\r\nimport { Breadcrumbs, IBreadcrumbConfig, HelpTooltip } from '../components'\r\n\r\nexport interface IToolbarPannelOptions {\r\n searchInclude?: string[]\r\n formCreate?: React.ReactNode\r\n afterAction?: React.ReactNode\r\n breadcrumbs?: IBreadcrumbConfig[]\r\n}\r\n\r\nexport interface IToolbarPannelProps extends IToolbarPannelOptions {\r\n title?: React.ReactNode\r\n afterTitle?: React.ReactNode\r\n}\r\n\r\nclass ToolbarPannel extends Component<React.PropsWithChildren<IToolbarPannelProps>> {\r\n render() {\r\n return (\r\n <Box sx={{ padding: '0 6px' }}>\r\n {this.renderTitle()}\r\n <Box sx={{ display: 'flex' }}>\r\n <Box sx={{ flex: 1, display: 'flex', alignItems: 'center', flexWrap: 'wrap' }}>\r\n <GridToolbar sx={{ padding: 0 }} />\r\n {this.props.formCreate && <BtnFormCreate>{this.props.formCreate}</BtnFormCreate>}\r\n {this.props.afterAction}\r\n </Box>\r\n <Box sx={{ display: 'flex', gap: '8px', alignItems: 'center' }}>\r\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\r\n <GridToolbarQuickFilter fullWidth variant='standard' size='small' debounceMs={800} quickFilterParser={(x: any) => [x]} />\r\n {this.renderEndAdornment()}\r\n </Box>\r\n </Box>\r\n </Box>\r\n </Box>\r\n )\r\n }\r\n\r\n renderTitle = () => {\r\n const { title, afterTitle, breadcrumbs } = this.props\r\n\r\n const isVisible = !!title || !!breadcrumbs || !!afterTitle\r\n if (!isVisible) return <></>\r\n\r\n let titleElm = title\r\n if (typeof title === 'string') titleElm = <Title>{title}</Title>\r\n if (breadcrumbs) titleElm = <Breadcrumbs value={breadcrumbs} />\r\n\r\n return (\r\n <Box sx={{ height: '56px', display: 'flex', alignItems: 'center' }}>\r\n {titleElm}\r\n {afterTitle}\r\n </Box>\r\n )\r\n }\r\n\r\n renderEndAdornment = () => {\r\n if (!this.props.searchInclude || this.props.searchInclude.length <= 0) return <></>\r\n return (\r\n <HelpTooltip title='The search includes' small>\r\n <SeachHelp>\r\n {this.props.searchInclude.map((item, index) => (\r\n <li key={index}>\r\n <Typography variant='body2'>{item}</Typography>\r\n </li>\r\n ))}\r\n </SeachHelp>\r\n </HelpTooltip>\r\n )\r\n }\r\n}\r\n\r\nexport default ToolbarPannel\r\n\r\nconst SeachHelp = styled('ul')({\r\n margin: '0 0 0 18px',\r\n padding: 0,\r\n li: {\r\n position: 'relative'\r\n },\r\n 'li::after': {\r\n content: '\"►\"',\r\n display: 'inline-block',\r\n top: '50%',\r\n transform: 'translateY(-50%)',\r\n position: 'absolute',\r\n left: '-18px'\r\n }\r\n})\r\n\r\nconst Title = styled((props: TypographyProps) => <Typography noWrap variant='subtitle1' {...props} />)({\r\n fontWeight: 700,\r\n flex: 1\r\n})\r\n"],"names":["ToolbarPannel","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","this","concat","_defineProperty","_this$props","props","title","afterTitle","breadcrumbs","_jsx","titleElm","Title","children","Breadcrumbs","value","_jsxs","Box","sx","height","display","alignItems","searchInclude","HelpTooltip","small","SeachHelp","map","item","index","Typography","variant","_inherits","Component","_createClass","key","padding","renderTitle","flex","flexWrap","GridToolbar","formCreate","BtnFormCreate","afterAction","gap","GridToolbarQuickFilter","fullWidth","size","debounceMs","quickFilterParser","x","renderEndAdornment","styled","margin","li","position","content","top","transform","left","_objectSpread","noWrap","fontWeight"],"mappings":"0pBAkBMA,IAAAA,aAAc,SAAAA,IAAA,IAAAC,EAAAC,OAAAF,GAAA,IAAA,IAAAG,EAAAC,UAAAC,OAAAC,EAAAC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAAF,EAAAE,GAAAJ,UAAAI,GAqDjB,OArDiBP,EAAAQ,EAAAC,KAAAV,EAAAW,GAAAA,OAAAL,IAAAM,EAAAX,EAAA,eAsBJ,WACZ,IAAAY,EAA2CZ,EAAKa,MAAxCC,EAAKF,EAALE,MAAOC,EAAUH,EAAVG,WAAYC,EAAWJ,EAAXI,YAG3B,OADoBF,KAAWE,KAAiBD,GAChC,OAAOE,QAEvB,IAAIC,EAAWJ,EAIf,MAHqB,iBAAVA,IAAoBI,EAAWD,EAACE,EAAO,CAAAC,SAAAN,KAC9CE,IAAaE,EAAWD,EAACI,EAAW,CAACC,MAAON,KAG9CO,EAACC,EAAI,CAAAC,GAAI,CAAEC,OAAQ,OAAQC,QAAS,OAAQC,WAAY,UACrDR,SAAA,CAAAF,EACAH,QAGNJ,EAAAX,EAAA,sBAEoB,WACnB,OAAKA,EAAKa,MAAMgB,eAAiB7B,EAAKa,MAAMgB,cAAczB,QAAU,EAAUa,QAE5EA,EAACa,EAAW,CAAChB,MAAM,sBAAsBiB,OAAK,EAAAX,SAC5CH,EAACe,EAAS,CAAAZ,SACPpB,EAAKa,MAAMgB,cAAcI,KAAI,SAACC,EAAMC,GAAK,OACxClB,iBACEA,EAACmB,EAAW,CAAAC,QAAQ,iBAASH,KADtBC,EAGV,WAIRnC,CAAA,CAAA,OAAAsC,EAAAvC,EArDyBwC,GAqDzBC,EAAAzC,EAAA,CAAA,CAAA0C,IAAA,SAAAnB,MApDD,WACE,OACEC,EAACC,EAAI,CAAAC,GAAI,CAAEiB,QAAS,SACjBtB,SAAA,CAAAX,KAAKkC,cACNpB,EAACC,EAAG,CAACC,GAAI,CAAEE,QAAS,QAAQP,SAAA,CAC1BG,EAACC,GAAIC,GAAI,CAAEmB,KAAM,EAAGjB,QAAS,OAAQC,WAAY,SAAUiB,SAAU,kBACnE5B,EAAC6B,EAAY,CAAArB,GAAI,CAAEiB,QAAS,KAC3BjC,KAAKI,MAAMkC,YAAc9B,EAAC+B,EAAe,CAAA5B,SAAAX,KAAKI,MAAMkC,aACpDtC,KAAKI,MAAMoC,eAEdhC,EAACO,EAAG,CAACC,GAAI,CAAEE,QAAS,OAAQuB,IAAK,MAAOtB,WAAY,UAClDR,SAAAG,EAACC,EAAI,CAAAC,GAAI,CAAEE,QAAS,OAAQC,WAAY,UACtCR,SAAA,CAAAH,EAACkC,EAAuB,CAAAC,WAAU,EAAAf,QAAQ,WAAWgB,KAAK,QAAQC,WAAY,IAAKC,kBAAmB,SAACC,GAAM,MAAK,CAACA,EAAE,IACpH/C,KAAKgD,+BAMlB,IAAC,IAsCGzB,EAAY0B,EAAO,KAAPA,CAAa,CAC7BC,OAAQ,aACRjB,QAAS,EACTkB,GAAI,CACFC,SAAU,YAEZ,YAAa,CACXC,QAAS,MACTnC,QAAS,eACToC,IAAK,MACLC,UAAW,mBACXH,SAAU,WACVI,KAAM,WAIJ9C,EAAQuC,GAAO,SAAC7C,GAAsB,OAAKI,EAACmB,EAAU8B,EAAA,CAACC,UAAO9B,QAAQ,aAAgBxB,GAAS,GAAvF6C,CAAyF,CACrGU,WAAY,IACZxB,KAAM"}
|
package/dist/table/ui.buttons.js
CHANGED
|
@@ -1,67 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Tooltip, IconButton, Button } from '@mui/material';
|
|
3
|
-
import ViewListIcon from '@mui/icons-material/ViewList';
|
|
4
|
-
import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline';
|
|
5
|
-
import 'react';
|
|
6
|
-
import '../api-context/alert-global.js';
|
|
7
|
-
import '../api-context/drawer-global.js';
|
|
8
|
-
import { MapGlobalModalContext } from '../api-context/global-modal.js';
|
|
9
|
-
|
|
10
|
-
var BtnFormCreate = function BtnFormCreate(props) {
|
|
11
|
-
return MapGlobalModalContext(function (context) {
|
|
12
|
-
return jsx(Tooltip, {
|
|
13
|
-
title: 'Create new',
|
|
14
|
-
children: jsx(Button, {
|
|
15
|
-
size: 'small',
|
|
16
|
-
onClick: function onClick() {
|
|
17
|
-
return context.show({
|
|
18
|
-
renderContent: function renderContent() {
|
|
19
|
-
return props.children;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
startIcon: jsx(AddCircleOutlineIcon, {
|
|
24
|
-
fontSize: 'small'
|
|
25
|
-
}),
|
|
26
|
-
sx: {
|
|
27
|
-
fontWeight: 600
|
|
28
|
-
},
|
|
29
|
-
variant: 'contained',
|
|
30
|
-
children: "Create"
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
var BtnFormDetail = function BtnFormDetail(props) {
|
|
36
|
-
return MapGlobalModalContext(function (context) {
|
|
37
|
-
return jsx(Tooltip, {
|
|
38
|
-
title: 'Detail',
|
|
39
|
-
children: jsx(IconButton, {
|
|
40
|
-
onClick: function onClick(e) {
|
|
41
|
-
var _props$onOpenModal;
|
|
42
|
-
(_props$onOpenModal = props.onOpenModal) === null || _props$onOpenModal === void 0 || _props$onOpenModal.call(props, e);
|
|
43
|
-
context.show({
|
|
44
|
-
backdropActivated: true,
|
|
45
|
-
renderContent: function renderContent() {
|
|
46
|
-
return props.formDetail;
|
|
47
|
-
},
|
|
48
|
-
onClose: props.onCloseModal
|
|
49
|
-
});
|
|
50
|
-
},
|
|
51
|
-
children: jsx(ViewListIcon, {})
|
|
52
|
-
})
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
var BtnDetail = function BtnDetail(props) {
|
|
57
|
-
return jsx(Tooltip, {
|
|
58
|
-
title: 'Detail',
|
|
59
|
-
children: jsx(IconButton, {
|
|
60
|
-
onClick: props.onClick,
|
|
61
|
-
children: jsx(ViewListIcon, {})
|
|
62
|
-
})
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export { BtnDetail, BtnFormCreate, BtnFormDetail };
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Tooltip as n,IconButton as r,Button as i}from"@mui/material";import e from"@mui/icons-material/ViewList";import o from"@mui/icons-material/AddCircleOutline";import"react";import"../api-context/alert-global.js";import"../api-context/drawer-global.js";import{MapGlobalModalContext as l}from"../api-context/global-modal.js";var a=function(r){return l((function(e){return t(n,{title:"Create new",children:t(i,{size:"small",onClick:function(){return e.show({renderContent:function(){return r.children}})},startIcon:t(o,{fontSize:"small"}),sx:{fontWeight:600},variant:"contained",children:"Create"})})}))},c=function(i){return l((function(o){return t(n,{title:"Detail",children:t(r,{onClick:function(t){var n;null===(n=i.onOpenModal)||void 0===n||n.call(i,t),o.show({backdropActivated:!0,renderContent:function(){return i.formDetail},onClose:i.onCloseModal})},children:t(e,{})})})}))},m=function(i){return t(n,{title:"Detail",children:t(r,{onClick:i.onClick,children:t(e,{})})})};export{m as BtnDetail,a as BtnFormCreate,c as BtnFormDetail};
|
|
67
2
|
//# sourceMappingURL=ui.buttons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.buttons.js","sources":["../../src/table/ui.buttons.tsx"],"sourcesContent":["import React, { FC } from 'react'\r\nimport { Button, IconButton, IconButtonProps, Tooltip } from '@mui/material'\r\nimport ViewListIcon from '@mui/icons-material/ViewList'\r\nimport AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'\r\nimport { MapGlobalModalContext, TModalReason } from '../api-context'\r\n\r\nexport const BtnFormCreate: FC<{ children: React.ReactNode }> = (props) => {\r\n return MapGlobalModalContext((context) => (\r\n <Tooltip title='Create new'>\r\n <Button\r\n size='small'\r\n onClick={() => context.show({ renderContent: () => props.children })}\r\n startIcon={<AddCircleOutlineIcon fontSize='small' />}\r\n sx={{ fontWeight: 600 }}\r\n variant='contained'\r\n >\r\n Create\r\n </Button>\r\n </Tooltip>\r\n ))\r\n}\r\n\r\nexport interface IBtnFormDetailProps {\r\n formDetail: React.ReactNode\r\n onOpenModal?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\r\n onCloseModal?: (reason?: TModalReason) => void\r\n}\r\n\r\nexport const BtnFormDetail: FC<IBtnFormDetailProps> = (props) => {\r\n return MapGlobalModalContext((context) => (\r\n <Tooltip title='Detail'>\r\n <IconButton\r\n onClick={(e) => {\r\n props.onOpenModal?.(e)\r\n context.show({ backdropActivated: true, renderContent: () => props.formDetail, onClose: props.onCloseModal })\r\n }}\r\n >\r\n <ViewListIcon />\r\n </IconButton>\r\n </Tooltip>\r\n ))\r\n}\r\n\r\nexport interface IBtnDetailProps {\r\n onClick?: IconButtonProps['onClick']\r\n}\r\n\r\nexport const BtnDetail: FC<IBtnDetailProps> = (props) => (\r\n <Tooltip title='Detail'>\r\n <IconButton onClick={props.onClick}>\r\n <ViewListIcon />\r\n </IconButton>\r\n </Tooltip>\r\n)\r\n"],"names":["BtnFormCreate","props","MapGlobalModalContext","context","_jsx","Tooltip","title","children","Button","size","onClick","show","renderContent","startIcon","AddCircleOutlineIcon","fontSize","sx","fontWeight","variant","BtnFormDetail","IconButton","e","_props$onOpenModal","onOpenModal","call","backdropActivated","formDetail","onClose","onCloseModal","ViewListIcon","BtnDetail"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ui.buttons.js","sources":["../../src/table/ui.buttons.tsx"],"sourcesContent":["import React, { FC } from 'react'\r\nimport { Button, IconButton, IconButtonProps, Tooltip } from '@mui/material'\r\nimport ViewListIcon from '@mui/icons-material/ViewList'\r\nimport AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'\r\nimport { MapGlobalModalContext, TModalReason } from '../api-context'\r\n\r\nexport const BtnFormCreate: FC<{ children: React.ReactNode }> = (props) => {\r\n return MapGlobalModalContext((context) => (\r\n <Tooltip title='Create new'>\r\n <Button\r\n size='small'\r\n onClick={() => context.show({ renderContent: () => props.children })}\r\n startIcon={<AddCircleOutlineIcon fontSize='small' />}\r\n sx={{ fontWeight: 600 }}\r\n variant='contained'\r\n >\r\n Create\r\n </Button>\r\n </Tooltip>\r\n ))\r\n}\r\n\r\nexport interface IBtnFormDetailProps {\r\n formDetail: React.ReactNode\r\n onOpenModal?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void\r\n onCloseModal?: (reason?: TModalReason) => void\r\n}\r\n\r\nexport const BtnFormDetail: FC<IBtnFormDetailProps> = (props) => {\r\n return MapGlobalModalContext((context) => (\r\n <Tooltip title='Detail'>\r\n <IconButton\r\n onClick={(e) => {\r\n props.onOpenModal?.(e)\r\n context.show({ backdropActivated: true, renderContent: () => props.formDetail, onClose: props.onCloseModal })\r\n }}\r\n >\r\n <ViewListIcon />\r\n </IconButton>\r\n </Tooltip>\r\n ))\r\n}\r\n\r\nexport interface IBtnDetailProps {\r\n onClick?: IconButtonProps['onClick']\r\n}\r\n\r\nexport const BtnDetail: FC<IBtnDetailProps> = (props) => (\r\n <Tooltip title='Detail'>\r\n <IconButton onClick={props.onClick}>\r\n <ViewListIcon />\r\n </IconButton>\r\n </Tooltip>\r\n)\r\n"],"names":["BtnFormCreate","props","MapGlobalModalContext","context","_jsx","Tooltip","title","children","Button","size","onClick","show","renderContent","startIcon","AddCircleOutlineIcon","fontSize","sx","fontWeight","variant","BtnFormDetail","IconButton","e","_props$onOpenModal","onOpenModal","call","backdropActivated","formDetail","onClose","onCloseModal","ViewListIcon","BtnDetail"],"mappings":"oXAMaA,EAAmD,SAACC,GAC/D,OAAOC,GAAsB,SAACC,GAAO,OACnCC,EAACC,EAAO,CAACC,MAAM,aACbC,SAAAH,EAACI,EAAM,CACLC,KAAK,QACLC,QAAS,WAAF,OAAQP,EAAQQ,KAAK,CAAEC,cAAe,WAAF,OAAQX,EAAMM,QAAQ,GAAG,EACpEM,UAAWT,EAACU,EAAqB,CAAAC,SAAS,UAC1CC,GAAI,CAAEC,WAAY,KAClBC,QAAQ,YAAWX,SAAA,YAIb,GAEd,EAQaY,EAAyC,SAAClB,GACrD,OAAOC,GAAsB,SAACC,GAAO,OACnCC,EAACC,EAAO,CAACC,MAAM,SACbC,SAAAH,EAACgB,EAAU,CACTV,QAAS,SAACW,GAAK,IAAAC,EACIA,QAAjBA,EAAArB,EAAMsB,mBAAND,IAAiBA,GAAjBA,EAAAE,KAAAvB,EAAoBoB,GACpBlB,EAAQQ,KAAK,CAAEc,mBAAmB,EAAMb,cAAe,WAAF,OAAQX,EAAMyB,UAAU,EAAEC,QAAS1B,EAAM2B,cAC/F,EAAArB,SAEDH,EAACyB,EAAY,CAAA,MAEP,GAEd,EAMaC,EAAiC,SAAC7B,GAAK,OAClDG,EAACC,EAAO,CAACC,MAAM,SACbC,SAAAH,EAACgB,EAAU,CAACV,QAAST,EAAMS,QACzBH,SAAAH,EAACyB,EAAY,CAAA,MAEP"}
|
package/dist/table/ui.units.js
CHANGED
|
@@ -1,248 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { useState, useEffect } from 'react';
|
|
4
|
-
import { styled, Typography, Box, Chip, Tooltip, IconButton, Divider } from '@mui/material';
|
|
5
|
-
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
|
6
|
-
import { mergeObjects as _mergeObjects } from '../utils/helpers.js';
|
|
7
|
-
import '../utils/query-param.js';
|
|
8
|
-
import '../utils/dayjs-config.js';
|
|
9
|
-
import '../components/breadcrumbs.js';
|
|
10
|
-
import CopyToClipboard from '../components/copy-to-clipboard.js';
|
|
11
|
-
import { HelpTooltipWrap } from '../components/help-tooltip.js';
|
|
12
|
-
import '../components/text-editor.js';
|
|
13
|
-
import dayjs from 'dayjs';
|
|
14
|
-
|
|
15
|
-
var _excluded = ["children"];
|
|
16
|
-
var CreateStatusCell = function CreateStatusCell(config, options) {
|
|
17
|
-
var StatusCell = function StatusCell(props) {
|
|
18
|
-
var _props$slots;
|
|
19
|
-
var getSxProps = function getSxProps() {
|
|
20
|
-
var _slots$typographyProp;
|
|
21
|
-
var data = props.value,
|
|
22
|
-
sx = props.sx,
|
|
23
|
-
slots = props.slots;
|
|
24
|
-
return Object.assign({}, data ? config[data] : {}, options === null || options === void 0 ? void 0 : options.sx, sx, slots === null || slots === void 0 || (_slots$typographyProp = slots.typographyProps) === null || _slots$typographyProp === void 0 ? void 0 : _slots$typographyProp.sx);
|
|
25
|
-
};
|
|
26
|
-
if (!props.value) return jsx(Fragment, {});
|
|
27
|
-
return jsx(CustomTypography, _objectSpread2(_objectSpread2({
|
|
28
|
-
onClick: props.onClick
|
|
29
|
-
}, (_props$slots = props.slots) === null || _props$slots === void 0 ? void 0 : _props$slots.typographyProps), {}, {
|
|
30
|
-
sx: getSxProps(),
|
|
31
|
-
children: props.title || props.value
|
|
32
|
-
}));
|
|
33
|
-
};
|
|
34
|
-
return StatusCell;
|
|
35
|
-
};
|
|
36
|
-
var CustomTypography = styled(Typography)({
|
|
37
|
-
borderRadius: '4px',
|
|
38
|
-
fontSize: '0.8rem',
|
|
39
|
-
padding: '4px 9px',
|
|
40
|
-
fontWeight: 600,
|
|
41
|
-
minWidth: '70px',
|
|
42
|
-
textAlign: 'center',
|
|
43
|
-
color: '#ffffff',
|
|
44
|
-
display: 'inline-block'
|
|
45
|
-
});
|
|
46
|
-
var CellImageSmall = function CellImageSmall(props) {
|
|
47
|
-
var _props$imageUri;
|
|
48
|
-
var _useState = useState((_props$imageUri = props.imageUri) !== null && _props$imageUri !== void 0 ? _props$imageUri : props.fallbackSrc),
|
|
49
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
-
imgSrc = _useState2[0],
|
|
51
|
-
setImgSrc = _useState2[1];
|
|
52
|
-
useEffect(function () {
|
|
53
|
-
var _props$imageUri2;
|
|
54
|
-
setImgSrc((_props$imageUri2 = props.imageUri) !== null && _props$imageUri2 !== void 0 ? _props$imageUri2 : props.fallbackSrc);
|
|
55
|
-
}, [props.imageUri, props.fallbackSrc]);
|
|
56
|
-
return jsxs(Box, {
|
|
57
|
-
sx: {
|
|
58
|
-
display: 'flex',
|
|
59
|
-
alignItems: 'center',
|
|
60
|
-
height: '100%',
|
|
61
|
-
gap: '10px'
|
|
62
|
-
},
|
|
63
|
-
children: [jsx(ImageSmall, {
|
|
64
|
-
src: imgSrc,
|
|
65
|
-
onError: function onError() {
|
|
66
|
-
return setImgSrc(props.fallbackSrc);
|
|
67
|
-
}
|
|
68
|
-
}), jsx(Typography, {
|
|
69
|
-
variant: 'body1',
|
|
70
|
-
children: props.value
|
|
71
|
-
})]
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
var ImageSmallFallback = function ImageSmallFallback(props) {
|
|
75
|
-
var _props$imageUri3;
|
|
76
|
-
var _useState3 = useState((_props$imageUri3 = props.imageUri) !== null && _props$imageUri3 !== void 0 ? _props$imageUri3 : props.imageFallback),
|
|
77
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
78
|
-
imgSrc = _useState4[0],
|
|
79
|
-
setImgSrc = _useState4[1];
|
|
80
|
-
useEffect(function () {
|
|
81
|
-
var _props$imageUri4;
|
|
82
|
-
setImgSrc((_props$imageUri4 = props.imageUri) !== null && _props$imageUri4 !== void 0 ? _props$imageUri4 : props.imageFallback);
|
|
83
|
-
}, [props.imageUri, props.imageFallback]);
|
|
84
|
-
return jsx(ImageSmall, {
|
|
85
|
-
src: imgSrc,
|
|
86
|
-
onError: function onError() {
|
|
87
|
-
return setImgSrc(props.imageFallback);
|
|
88
|
-
},
|
|
89
|
-
sx: props.sx
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
var ImageSmall = styled('img')({
|
|
93
|
-
backgroundRepeat: 'no-repeat',
|
|
94
|
-
height: '50px',
|
|
95
|
-
width: '50px',
|
|
96
|
-
backgroundSize: 'contain',
|
|
97
|
-
borderRadius: '8px',
|
|
98
|
-
boxShadow: 'rgba(0, 0, 0, 0.16) 0px 1px 4px'
|
|
99
|
-
});
|
|
100
|
-
var CellBase = function CellBase(props) {
|
|
101
|
-
var _props$valueFormatted;
|
|
102
|
-
var value = (_props$valueFormatted = props.valueFormatted) !== null && _props$valueFormatted !== void 0 ? _props$valueFormatted : props.value;
|
|
103
|
-
var isCopyToClipboard = !!props.copyToClipboard && !!value;
|
|
104
|
-
return jsxs(CellBaseWrap, _objectSpread2(_objectSpread2({
|
|
105
|
-
title: value
|
|
106
|
-
}, props.wrapProps), {}, {
|
|
107
|
-
children: [props.imageUrl && jsx(ImageSmallFallback, {
|
|
108
|
-
imageUri: props.imageUrl,
|
|
109
|
-
sx: {
|
|
110
|
-
mr: '10px'
|
|
111
|
-
},
|
|
112
|
-
imageFallback: props.imageFallbackSrc
|
|
113
|
-
}), jsx(Typography, _objectSpread2(_objectSpread2({
|
|
114
|
-
variant: 'body2',
|
|
115
|
-
component: 'span',
|
|
116
|
-
noWrap: true,
|
|
117
|
-
sx: {
|
|
118
|
-
flex: 1
|
|
119
|
-
}
|
|
120
|
-
}, props.typographyProps), {}, {
|
|
121
|
-
children: value
|
|
122
|
-
})), value && props.openInNewTab === true && jsx(Tooltip, {
|
|
123
|
-
arrow: true,
|
|
124
|
-
title: 'Open new tab',
|
|
125
|
-
children: jsx(IconButton, {
|
|
126
|
-
component: 'a',
|
|
127
|
-
href: value,
|
|
128
|
-
target: '_blank',
|
|
129
|
-
children: jsx(OpenInNewIcon, {
|
|
130
|
-
fontSize: 'small',
|
|
131
|
-
sx: {
|
|
132
|
-
color: '#1A75E2'
|
|
133
|
-
}
|
|
134
|
-
})
|
|
135
|
-
})
|
|
136
|
-
}), isCopyToClipboard && jsx(CopyToClipboard, {
|
|
137
|
-
value: value
|
|
138
|
-
}), value && props.beforeLine === true && jsx(Divider, {
|
|
139
|
-
flexItem: true,
|
|
140
|
-
variant: 'middle',
|
|
141
|
-
orientation: 'vertical'
|
|
142
|
-
})]
|
|
143
|
-
}));
|
|
144
|
-
};
|
|
145
|
-
var CellBaseWrap = styled(function (_ref) {
|
|
146
|
-
var children = _ref.children,
|
|
147
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
148
|
-
return jsx(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
149
|
-
children: jsx("div", {
|
|
150
|
-
children: children
|
|
151
|
-
})
|
|
152
|
-
}));
|
|
153
|
-
})({
|
|
154
|
-
flex: 1,
|
|
155
|
-
width: '100%',
|
|
156
|
-
height: '100%',
|
|
157
|
-
position: 'relative',
|
|
158
|
-
top: 0,
|
|
159
|
-
left: 0,
|
|
160
|
-
'& > div': {
|
|
161
|
-
display: 'flex',
|
|
162
|
-
alignItems: 'center',
|
|
163
|
-
width: '100%',
|
|
164
|
-
height: '100%',
|
|
165
|
-
position: 'absolute',
|
|
166
|
-
top: 0,
|
|
167
|
-
left: 0
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
var CellChips = function CellChips(props) {
|
|
171
|
-
var _props$value, _props$separator;
|
|
172
|
-
if (typeof props.value !== 'string') return (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : jsx(Fragment, {});
|
|
173
|
-
var list = props.value.split((_props$separator = props === null || props === void 0 ? void 0 : props.separator) !== null && _props$separator !== void 0 ? _props$separator : '|').filter(function (x) {
|
|
174
|
-
return !!x;
|
|
175
|
-
});
|
|
176
|
-
var displayList = props !== null && props !== void 0 && props.maximum ? list.slice(0, props.maximum) : list;
|
|
177
|
-
var remainingCount = props !== null && props !== void 0 && props.maximum && list.length > props.maximum ? list.length - props.maximum : 0;
|
|
178
|
-
return jsxs(Box, {
|
|
179
|
-
sx: {
|
|
180
|
-
display: 'flex',
|
|
181
|
-
alignItems: 'center',
|
|
182
|
-
flexWrap: 'wrap',
|
|
183
|
-
gap: '4px',
|
|
184
|
-
height: '100%'
|
|
185
|
-
},
|
|
186
|
-
children: [displayList.map(function (x, i) {
|
|
187
|
-
return jsx(CustomChip, {
|
|
188
|
-
label: x,
|
|
189
|
-
size: 'small'
|
|
190
|
-
}, 'key' + i);
|
|
191
|
-
}), remainingCount > 0 && jsx(HelpTooltipWrap, {
|
|
192
|
-
title: 'Artists',
|
|
193
|
-
content: jsx(Box, {
|
|
194
|
-
sx: {
|
|
195
|
-
display: 'flex',
|
|
196
|
-
alignItems: 'center',
|
|
197
|
-
flexWrap: 'wrap',
|
|
198
|
-
gap: '4px'
|
|
199
|
-
},
|
|
200
|
-
children: list.map(function (x, i) {
|
|
201
|
-
return jsx(CustomChip, {
|
|
202
|
-
label: x,
|
|
203
|
-
size: 'small'
|
|
204
|
-
}, 'key' + i);
|
|
205
|
-
})
|
|
206
|
-
}),
|
|
207
|
-
children: jsx(CustomChip, {
|
|
208
|
-
label: "+".concat(remainingCount),
|
|
209
|
-
size: 'small'
|
|
210
|
-
}, 'remaining')
|
|
211
|
-
})]
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
|
-
var CustomChip = styled(Chip)({
|
|
215
|
-
lineHeight: 1
|
|
216
|
-
});
|
|
217
|
-
var CellDate = function CellDate(props) {
|
|
218
|
-
try {
|
|
219
|
-
var _props$showRelative, _props$typographyProp;
|
|
220
|
-
var showRelative = (_props$showRelative = props === null || props === void 0 ? void 0 : props.showRelative) !== null && _props$showRelative !== void 0 ? _props$showRelative : false;
|
|
221
|
-
var date = dayjs(props.value);
|
|
222
|
-
var formatted = date.format(props.formatString);
|
|
223
|
-
var value = showRelative ? "".concat(formatted, " (").concat(dayjs().to(date), ")") : formatted;
|
|
224
|
-
var sx = props.styledGetter ? props.styledGetter(props.value) : {
|
|
225
|
-
flex: 1
|
|
226
|
-
};
|
|
227
|
-
var mergeTypographyProps = _mergeObjects({}, (_props$typographyProp = props.typographyProps) !== null && _props$typographyProp !== void 0 ? _props$typographyProp : {}, {
|
|
228
|
-
sx: sx
|
|
229
|
-
});
|
|
230
|
-
return jsx(Typography, _objectSpread2(_objectSpread2({
|
|
231
|
-
variant: 'body2',
|
|
232
|
-
component: 'span',
|
|
233
|
-
noWrap: true
|
|
234
|
-
}, mergeTypographyProps), {}, {
|
|
235
|
-
children: value
|
|
236
|
-
}));
|
|
237
|
-
} catch (_unused) {
|
|
238
|
-
return jsx(Typography, {
|
|
239
|
-
variant: 'body2',
|
|
240
|
-
component: 'span',
|
|
241
|
-
noWrap: true,
|
|
242
|
-
children: "format invalid"
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
export { CellBase, CellChips, CellDate, CellImageSmall, CreateStatusCell, ImageSmallFallback };
|
|
1
|
+
import{objectWithoutProperties as e,objectSpread2 as r,slicedToArray as i}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as t,Fragment as a,jsxs as l}from"react/jsx-runtime";import{useState as n,useEffect as o}from"react";import{styled as p,Typography as c,Box as m,Chip as s,Tooltip as u,IconButton as d,Divider as f}from"@mui/material";import v from"@mui/icons-material/OpenInNew";import{mergeObjects as g}from"../utils/helpers.js";import"../utils/query-param.js";import"../utils/dayjs-config.js";import"../components/breadcrumbs.js";import x from"../components/copy-to-clipboard.js";import{HelpTooltipWrap as h}from"../components/help-tooltip.js";import"../components/text-editor.js";import b from"dayjs";var y=["children"],k=function(e,i){return function(l){var n,o,p,c,m;return l.value?t(j,r(r({onClick:l.onClick},null===(n=l.slots)||void 0===n?void 0:n.typographyProps),{},{sx:(p=l.value,c=l.sx,m=l.slots,Object.assign({},p?e[p]:{},null==i?void 0:i.sx,c,null==m||null===(o=m.typographyProps)||void 0===o?void 0:o.sx)),children:l.title||l.value})):t(a,{})}},j=p(c)({borderRadius:"4px",fontSize:"0.8rem",padding:"4px 9px",fontWeight:600,minWidth:"70px",textAlign:"center",color:"#ffffff",display:"inline-block"}),w=function(e){var r,a=n(null!==(r=e.imageUri)&&void 0!==r?r:e.fallbackSrc),p=i(a,2),s=p[0],u=p[1];return o((function(){var r;u(null!==(r=e.imageUri)&&void 0!==r?r:e.fallbackSrc)}),[e.imageUri,e.fallbackSrc]),l(m,{sx:{display:"flex",alignItems:"center",height:"100%",gap:"10px"},children:[t(U,{src:s,onError:function(){return u(e.fallbackSrc)}}),t(c,{variant:"body1",children:e.value})]})},S=function(e){var r,a=n(null!==(r=e.imageUri)&&void 0!==r?r:e.imageFallback),l=i(a,2),p=l[0],c=l[1];return o((function(){var r;c(null!==(r=e.imageUri)&&void 0!==r?r:e.imageFallback)}),[e.imageUri,e.imageFallback]),t(U,{src:p,onError:function(){return c(e.imageFallback)},sx:e.sx})},U=p("img")({backgroundRepeat:"no-repeat",height:"50px",width:"50px",backgroundSize:"contain",borderRadius:"8px",boxShadow:"rgba(0, 0, 0, 0.16) 0px 1px 4px"}),W=function(e){var i,a=null!==(i=e.valueFormatted)&&void 0!==i?i:e.value,n=!!e.copyToClipboard&&!!a;return l(F,r(r({title:a},e.wrapProps),{},{children:[e.imageUrl&&t(S,{imageUri:e.imageUrl,sx:{mr:"10px"},imageFallback:e.imageFallbackSrc}),t(c,r(r({variant:"body2",component:"span",noWrap:!0,sx:{flex:1}},e.typographyProps),{},{children:a})),a&&!0===e.openInNewTab&&t(u,{arrow:!0,title:"Open new tab",children:t(d,{component:"a",href:a,target:"_blank",children:t(v,{fontSize:"small",sx:{color:"#1A75E2"}})})}),n&&t(x,{value:a}),a&&!0===e.beforeLine&&t(f,{flexItem:!0,variant:"middle",orientation:"vertical"})]}))},F=p((function(i){var a=i.children,l=e(i,y);return t(m,r(r({},l),{},{children:t("div",{children:a})}))}))({flex:1,width:"100%",height:"100%",position:"relative",top:0,left:0,"& > div":{display:"flex",alignItems:"center",width:"100%",height:"100%",position:"absolute",top:0,left:0}}),I=function(e){var r,i;if("string"!=typeof e.value)return null!==(r=e.value)&&void 0!==r?r:t(a,{});var n=e.value.split(null!==(i=null==e?void 0:e.separator)&&void 0!==i?i:"|").filter((function(e){return!!e})),o=null!=e&&e.maximum?n.slice(0,e.maximum):n,p=null!=e&&e.maximum&&n.length>e.maximum?n.length-e.maximum:0;return l(m,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"4px",height:"100%"},children:[o.map((function(e,r){return t(P,{label:e,size:"small"},"key"+r)})),p>0&&t(h,{title:"Artists",content:t(m,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"4px"},children:n.map((function(e,r){return t(P,{label:e,size:"small"},"key"+r)}))}),children:t(P,{label:"+".concat(p),size:"small"},"remaining")})]})},P=p(s)({lineHeight:1}),z=function(e){try{var i,a,l=null!==(i=null==e?void 0:e.showRelative)&&void 0!==i&&i,n=b(e.value),o=n.format(e.formatString),p=l?"".concat(o," (").concat(b().to(n),")"):o,m=e.styledGetter?e.styledGetter(e.value):{flex:1},s=g({},null!==(a=e.typographyProps)&&void 0!==a?a:{},{sx:m});return t(c,r(r({variant:"body2",component:"span",noWrap:!0},s),{},{children:p}))}catch(e){return t(c,{variant:"body2",component:"span",noWrap:!0,children:"format invalid"})}};export{W as CellBase,I as CellChips,z as CellDate,w as CellImageSmall,k as CreateStatusCell,S as ImageSmallFallback};
|
|
248
2
|
//# sourceMappingURL=ui.units.js.map
|