@entropic-bond/crud-panel 4.0.3 → 4.1.0
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/lib/crud-controller.d.ts +2 -1
- package/lib/crud-controller.spec.d.ts +16 -0
- package/lib/crud-panel.spec.d.ts +1 -0
- package/lib/entropic-bond-crud-panel.js +2362 -0
- package/lib/entropic-bond-crud-panel.umd.cjs +45 -0
- package/lib/progress-controller.spec.d.ts +1 -0
- package/package.json +32 -23
- package/lib/crud-controller.js +0 -243
- package/lib/crud-controller.js.map +0 -1
- package/lib/crud-panel.js +0 -168
- package/lib/crud-panel.js.map +0 -1
- package/lib/index.js +0 -19
- package/lib/index.js.map +0 -1
- package/lib/progress-controller.js +0 -33
- package/lib/progress-controller.js.map +0 -1
package/lib/crud-panel.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.CrudPanel = void 0;
|
|
27
|
-
const entropic_bond_1 = require("entropic-bond");
|
|
28
|
-
const react_1 = __importStar(require("react"));
|
|
29
|
-
var Mode;
|
|
30
|
-
(function (Mode) {
|
|
31
|
-
Mode[Mode["normal"] = 0] = "normal";
|
|
32
|
-
Mode[Mode["add"] = 1] = "add";
|
|
33
|
-
Mode[Mode["edit"] = 2] = "edit";
|
|
34
|
-
})(Mode || (Mode = {}));
|
|
35
|
-
class CrudPanel extends react_1.Component {
|
|
36
|
-
constructor(props) {
|
|
37
|
-
super(props);
|
|
38
|
-
this.unfilteredDocuments = [];
|
|
39
|
-
this.state = {
|
|
40
|
-
documents: [],
|
|
41
|
-
mode: Mode.normal,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
async componentDidMount() {
|
|
45
|
-
const { controller } = this.props;
|
|
46
|
-
this.unsubscriber = controller.onChange(event => {
|
|
47
|
-
if (event.documentCollection) {
|
|
48
|
-
this.unfilteredDocuments = event.documentCollection;
|
|
49
|
-
this.setState({
|
|
50
|
-
documents: controller.filter(this.unfilteredDocuments)
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
if (event.action === 'filterChange') {
|
|
54
|
-
this.setState({
|
|
55
|
-
documents: controller.filter(this.unfilteredDocuments)
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
else
|
|
59
|
-
this.setState({});
|
|
60
|
-
});
|
|
61
|
-
this.unfilteredDocuments = await controller.documentCollection();
|
|
62
|
-
this.setState({
|
|
63
|
-
documents: controller.filter(this.unfilteredDocuments)
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
componentWillUnmount() {
|
|
67
|
-
this.unsubscriber?.();
|
|
68
|
-
}
|
|
69
|
-
newDocument() {
|
|
70
|
-
this.props.controller.newDocument();
|
|
71
|
-
this.setState({
|
|
72
|
-
mode: Mode.add,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
editDocument(document) {
|
|
76
|
-
this.props.controller.setDocument(document);
|
|
77
|
-
this.setState({
|
|
78
|
-
mode: Mode.edit
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
async storeDocument(document) {
|
|
82
|
-
const { controller, layout } = this.props;
|
|
83
|
-
controller.setDocument(document);
|
|
84
|
-
await controller.storeDocument();
|
|
85
|
-
if (layout === 'formAndItems') {
|
|
86
|
-
this.newDocument();
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
this.setState({
|
|
90
|
-
mode: Mode.normal,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
invokeContentViewChild(labels) {
|
|
95
|
-
const { children, layout, controller } = this.props;
|
|
96
|
-
const { mode } = this.state;
|
|
97
|
-
const closeOnCancel = layout !== 'formAndItems';
|
|
98
|
-
if (!controller.document)
|
|
99
|
-
return;
|
|
100
|
-
const props = {
|
|
101
|
-
controller: controller,
|
|
102
|
-
submitButtonCaption: mode == Mode.edit ? labels?.updateButtonLabel : labels?.addButtonLabel,
|
|
103
|
-
onSubmit: (document) => this.storeDocument(document),
|
|
104
|
-
onCancel: closeOnCancel
|
|
105
|
-
? () => this.setState({ mode: Mode.normal })
|
|
106
|
-
: () => this.newDocument(),
|
|
107
|
-
};
|
|
108
|
-
if (typeof children[0] === 'function') {
|
|
109
|
-
return (0, react_1.cloneElement)(children[0](props), { key: controller.document.id });
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
return (0, react_1.cloneElement)(children[0], { key: controller.document.id, ...props });
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
invokeDetailViewChild(document) {
|
|
116
|
-
const { children, controller } = this.props;
|
|
117
|
-
const props = {
|
|
118
|
-
document,
|
|
119
|
-
onSelect: (document) => this.editDocument(document),
|
|
120
|
-
onDelete: (document) => controller.setDocument(document).deleteDocument()
|
|
121
|
-
};
|
|
122
|
-
if (typeof children[1] === 'function') {
|
|
123
|
-
return (0, react_1.cloneElement)(children[1](props), { key: document.id });
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
return (0, react_1.cloneElement)(children[1], { key: document.id, ...props });
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
render() {
|
|
130
|
-
const { mode, documents } = this.state;
|
|
131
|
-
const { className, cardAddButton, controller } = this.props;
|
|
132
|
-
const docClassName = (0, entropic_bond_1.snakeCase)(controller.document?.className);
|
|
133
|
-
let labels = this.props.labels || {};
|
|
134
|
-
const layout = this.props.layout || 'itemsAlways';
|
|
135
|
-
if (typeof labels === 'function')
|
|
136
|
-
labels = labels(controller);
|
|
137
|
-
const { addNewDocumentLabel, singularDocumentInCollectionCaption, documentsInCollectionCaption, noDocumentsFoundLabel } = labels;
|
|
138
|
-
return (react_1.default.createElement("div", { className: `crud-panel ${docClassName} ${className || ''}` },
|
|
139
|
-
mode === Mode.normal && layout !== 'formAndItems' && !cardAddButton &&
|
|
140
|
-
react_1.default.createElement("div", { className: "header" }, this.props.header
|
|
141
|
-
? typeof this.props.header === 'function'
|
|
142
|
-
? this.props.header(controller, () => this.newDocument(), labels)
|
|
143
|
-
: this.props.header
|
|
144
|
-
: react_1.default.createElement("button", { onClick: () => this.newDocument() }, addNewDocumentLabel)),
|
|
145
|
-
(layout === 'formAndItems' || mode === Mode.add || mode === Mode.edit) &&
|
|
146
|
-
react_1.default.createElement("div", { className: "content-panel" }, this.invokeContentViewChild(labels)),
|
|
147
|
-
(layout === 'itemsAlways' || layout === 'formAndItems' || mode === Mode.normal) &&
|
|
148
|
-
react_1.default.createElement("div", { className: "collection-panel" },
|
|
149
|
-
documents?.length > 0 &&
|
|
150
|
-
react_1.default.createElement("h3", null, documents.length > 1
|
|
151
|
-
? documentsInCollectionCaption
|
|
152
|
-
: singularDocumentInCollectionCaption || documentsInCollectionCaption),
|
|
153
|
-
react_1.default.createElement("div", { className: "documents" },
|
|
154
|
-
cardAddButton &&
|
|
155
|
-
react_1.default.createElement("div", { className: "crud-card card-add-button clickable", onClick: () => this.newDocument() },
|
|
156
|
-
react_1.default.createElement("div", { className: "button-element" }, cardAddButton),
|
|
157
|
-
react_1.default.createElement("div", { className: "add-label" }, addNewDocumentLabel)),
|
|
158
|
-
documents?.length
|
|
159
|
-
? documents.map((document) => this.invokeDetailViewChild(document))
|
|
160
|
-
: react_1.default.createElement("p", null, noDocumentsFoundLabel))),
|
|
161
|
-
react_1.default.createElement("div", { className: "footer" }, this.props.footer &&
|
|
162
|
-
typeof this.props.footer === 'function'
|
|
163
|
-
? this.props.footer(controller, () => this.newDocument(), labels)
|
|
164
|
-
: this.props.footer)));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
exports.CrudPanel = CrudPanel;
|
|
168
|
-
//# sourceMappingURL=crud-panel.js.map
|
package/lib/crud-panel.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crud-panel.js","sourceRoot":"","sources":["../src/crud-panel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0E;AAC1E,+CAAoE;AAGpE,IAAK,IAA0B;AAA/B,WAAK,IAAI;IAAG,mCAAM,CAAA;IAAE,6BAAG,CAAA;IAAE,+BAAI,CAAA;AAAC,CAAC,EAA1B,IAAI,KAAJ,IAAI,QAAsB;AA6C/B,MAAa,SAAuC,SAAQ,iBAA+C;IAE1G,YAAa,KAAwB;QACpC,KAAK,CAAE,KAAK,CAAE,CAAA;QA6LP,wBAAmB,GAAQ,EAAE,CAAA;QA3LpC,IAAI,CAAC,KAAK,GAAG;YACZ,SAAS,EAAE,EAAE;YACb,IAAI,EAAE,IAAI,CAAC,MAAM;SACjB,CAAA;IACF,CAAC;IAEQ,KAAK,CAAC,iBAAiB;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AG,aAAa,IAAI,MAAM,KAAK,cAAc,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM,CAAE;gBAEhF,uCAAK,SAAS,EAAC,kBAAkB;oBAC9B,SAAS,EAAE,MAAM,GAAG,CAAC;wBACtB,0CACG,SAAS,CAAC,MAAM,GAAG,CAAC;4BACrB,CAAC,CAAC,4BAA4B;4BAC9B,CAAC,CAAC,mCAAmC,IAAI,4BAA4B,CAElE;oBAGN,uCAAK,SAAS,EAAC,WAAW;wBACvB,aAAa;4BACd,uCAAK,SAAS,EAAC,qCAAqC,EACnD,OAAO,EAAG,GAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;gCAEjC,uCAAK,SAAS,EAAC,gBAAgB,IAAG,aAAa,CAAQ;gCACvD,uCAAK,SAAS,EAAC,WAAW,IAAG,mBAAmB,CAAQ,CACnD;wBAEL,SAAS,EAAE,MAAM;4BAClB,CAAC,CAAC,SAAS,CAAC,GAAG,CAAE,CAAC,QAAW,EAAE,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAE,QAAQ,CAAE,CAAE;4BAC1E,CAAC,CAAC,yCAAK,qBAAqB,CAAM,CAE9B,CACD;YAIP,uCAAK,SAAS,EAAC,QAAQ,IACpB,IAAI,CAAC,KAAK,CAAC,MAAM;gBAClB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,UAAU;gBACtC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAE,UAAU,EAAE,GAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,MAAM,CAAE;gBAClE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAEhB,CACD,CACN,CAAA;IACF,CAAC;CAID;AAjMD,8BAiMC"}
|
package/lib/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./crud-controller"), exports);
|
|
18
|
-
__exportStar(require("./crud-panel"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,+CAA4B"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProgressController = void 0;
|
|
4
|
-
const entropic_bond_1 = require("entropic-bond");
|
|
5
|
-
class ProgressController {
|
|
6
|
-
constructor() {
|
|
7
|
-
this._stages = {};
|
|
8
|
-
this._onProgress = new entropic_bond_1.Observable();
|
|
9
|
-
}
|
|
10
|
-
notifyBusy(busy, name) {
|
|
11
|
-
this.pushStage({
|
|
12
|
-
name: name ?? '', progress: busy ? 0 : 1, total: 1
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
pushStage(stage) {
|
|
16
|
-
this._stages[stage.name] = stage;
|
|
17
|
-
const overallProgress = Object.values(this._stages).reduce((prev, stage, _i, arr) => {
|
|
18
|
-
return prev + stage.progress / stage.total / arr.length;
|
|
19
|
-
}, 0);
|
|
20
|
-
this._onProgress.notify({
|
|
21
|
-
busy: overallProgress < 1,
|
|
22
|
-
overallProgress,
|
|
23
|
-
stages: this._stages
|
|
24
|
-
});
|
|
25
|
-
if (overallProgress >= 1)
|
|
26
|
-
this._stages = {};
|
|
27
|
-
}
|
|
28
|
-
onProgress(cb) {
|
|
29
|
-
return this._onProgress.subscribe(cb);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.ProgressController = ProgressController;
|
|
33
|
-
//# sourceMappingURL=progress-controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"progress-controller.js","sourceRoot":"","sources":["../src/progress-controller.ts"],"names":[],"mappings":";;;AAAA,iDAAoD;AAkBpD,MAAa,kBAAkB;IAA/B;QA2BS,YAAO,GAA4B,EAAE,CAAA;QACrC,gBAAW,GAA8B,IAAI,0BAAU,EAAiB,CAAA;IACjF,CAAC;IA5BA,UAAU,CAAE,IAAa,EAAE,IAAa;QACvC,IAAI,CAAC,SAAS,CAAC;YACd,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;SACjD,CAAC,CAAA;IACH,CAAC;IAED,SAAS,CAAE,KAAoB;QAC9B,IAAI,CAAC,OAAO,CAAE,KAAK,CAAC,IAAI,CAAE,GAAG,KAAK,CAAA;QAElC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAE,IAAI,CAAC,OAAO,CAAE,CAAC,MAAM,CAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;YACtF,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAA;QACxD,CAAC,EAAE,CAAC,CAAC,CAAA;QAEL,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YACvB,IAAI,EAAE,eAAe,GAAG,CAAC;YACzB,eAAe;YACf,MAAM,EAAE,IAAI,CAAC,OAAO;SACpB,CAAC,CAAA;QAEF,IAAK,eAAe,IAAI,CAAC;YAAG,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;IAC9C,CAAC;IAED,UAAU,CAAE,EAA2B;QACtC,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAE,EAAE,CAAE,CAAA;IACxC,CAAC;CAID;AA7BD,gDA6BC"}
|