@sankhyalabs/sankhyablocks 1.3.31-beta.1 → 1.3.31-beta.11
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/cjs/SnkMessageBuilder-13239761.js +188 -0
- package/dist/cjs/{index-1133bc2a.js → index-c6671817.js} +416 -9
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +283 -108
- package/dist/cjs/snk-crud.cjs.entry.js +64 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +277 -0
- package/dist/cjs/snk-form_2.cjs.entry.js +177 -0
- package/dist/cjs/snk-pesquisa.cjs.entry.js +6 -3
- package/dist/cjs/snk-taskbar.cjs.entry.js +159 -0
- package/dist/cjs/taskbar-elements-73d524e5.js +70 -0
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +5 -0
- package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +2 -2
- package/dist/collection/components/snk-application/snk-application.js +267 -63
- package/dist/collection/components/snk-crud/snk-crud.css +5 -0
- package/dist/collection/components/snk-crud/snk-crud.js +137 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.css +6 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +528 -0
- package/dist/collection/components/snk-form/snk-form.css +34 -0
- package/dist/collection/components/snk-form/snk-form.js +220 -0
- package/dist/collection/components/snk-grid/snk-grid.css +5 -0
- package/dist/collection/components/snk-grid/snk-grid.js +148 -0
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +56 -13
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +5 -1
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +65 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +3 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +271 -0
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +52 -21
- package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +4 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +2 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +119 -0
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +22 -0
- package/dist/collection/lib/message/resources/snk-form.msg.js +10 -0
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +16 -0
- package/dist/components/SnkMessageBuilder.js +166 -0
- package/dist/components/snk-application2.js +284 -107
- package/dist/components/snk-crud.d.ts +11 -0
- package/dist/components/snk-crud.js +101 -0
- package/dist/components/snk-data-unit.d.ts +11 -0
- package/dist/components/snk-data-unit.js +300 -0
- package/dist/components/snk-form.d.ts +11 -0
- package/dist/components/snk-form.js +6 -0
- package/dist/components/snk-form2.js +140 -0
- package/dist/components/snk-grid.d.ts +11 -0
- package/dist/components/snk-grid.js +6 -0
- package/dist/components/snk-grid2.js +91 -0
- package/dist/components/snk-pesquisa2.js +5 -2
- package/dist/components/snk-taskbar.d.ts +11 -0
- package/dist/components/snk-taskbar.js +6 -0
- package/dist/components/snk-taskbar2.js +240 -0
- package/dist/esm/SnkMessageBuilder-3835f9d8.js +166 -0
- package/dist/esm/{index-ffda6382.js → index-6a83ac96.js} +416 -10
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +283 -108
- package/dist/esm/snk-crud.entry.js +60 -0
- package/dist/esm/snk-data-unit.entry.js +273 -0
- package/dist/esm/snk-form_2.entry.js +172 -0
- package/dist/esm/snk-pesquisa.entry.js +6 -3
- package/dist/esm/snk-taskbar.entry.js +155 -0
- package/dist/esm/taskbar-elements-6d01a640.js +68 -0
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/p-4c7b32d6.entry.js +1 -0
- package/dist/sankhyablocks/p-5e1b7e51.entry.js +1 -0
- package/dist/sankhyablocks/p-72bccbb6.js +1 -0
- package/dist/sankhyablocks/p-8c74d163.entry.js +1 -0
- package/dist/sankhyablocks/p-bab507ad.entry.js +1 -0
- package/dist/sankhyablocks/p-cd1dc099.js +2 -0
- package/dist/sankhyablocks/{p-2a7b4cb3.entry.js → p-d25637c9.entry.js} +1 -1
- package/dist/sankhyablocks/p-dd10a5e3.js +1 -0
- package/dist/sankhyablocks/p-e942c604.entry.js +69 -0
- package/dist/sankhyablocks/p-f4d0394b.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +109 -15
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +25 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +53 -0
- package/dist/types/components.d.ts +372 -6
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +3 -3
- package/dist/types/lib/message/SnkMessageBuilder.d.ts +42 -0
- package/dist/types/lib/message/resources/snk-data-unit.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-form.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-taskbar.msg.d.ts +2 -0
- package/package.json +5 -5
- package/react/components.d.ts +5 -0
- package/react/components.js +5 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-d62412bb.entry.js +0 -1
- package/dist/sankhyablocks/p-e6e91d5f.entry.js +0 -69
- package/dist/sankhyablocks/p-edcb9d8e.js +0 -2
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-c6671817.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
const taskbarElements = require('./taskbar-elements-73d524e5.js');
|
|
8
|
+
|
|
9
|
+
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
|
|
10
|
+
|
|
11
|
+
const SnkTaskbar = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
this.actionClick = index.createEvent(this, "actionClick", 7);
|
|
15
|
+
}
|
|
16
|
+
observeButtons() {
|
|
17
|
+
this._definitions = undefined;
|
|
18
|
+
}
|
|
19
|
+
// Internal methods
|
|
20
|
+
elementsFromString(strButtons) {
|
|
21
|
+
const elements = [];
|
|
22
|
+
if (strButtons) {
|
|
23
|
+
strButtons.split(",").forEach(buttonName => {
|
|
24
|
+
buttonName = buttonName.trim();
|
|
25
|
+
if (this.isAllowed(buttonName)) {
|
|
26
|
+
elements.push(buttonName.trim());
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return elements;
|
|
31
|
+
}
|
|
32
|
+
isAllowed(buttonName) {
|
|
33
|
+
if (taskbarElements.AuthorizationElements[buttonName]) {
|
|
34
|
+
return this._permissions ? this._permissions.isSup || this._permissions[buttonName] : false;
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
40
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
41
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
42
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-taskbar.msg.ts"
|
|
43
|
+
*/
|
|
44
|
+
getTitle(element) {
|
|
45
|
+
switch (element) {
|
|
46
|
+
case taskbarElements.TaskbarElement.UPDATE:
|
|
47
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleUpdate", {});
|
|
48
|
+
case taskbarElements.TaskbarElement.PREVIOUS:
|
|
49
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titlePrevious", {});
|
|
50
|
+
case taskbarElements.TaskbarElement.NEXT:
|
|
51
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleNext", {});
|
|
52
|
+
case taskbarElements.TaskbarElement.REFRESH:
|
|
53
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleRefresh", {});
|
|
54
|
+
case taskbarElements.TaskbarElement.CLONE:
|
|
55
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleClone", {});
|
|
56
|
+
case taskbarElements.TaskbarElement.REMOVE:
|
|
57
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleRemove", {});
|
|
58
|
+
case taskbarElements.TaskbarElement.MORE_OPTIONS:
|
|
59
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleMoreOptions", {});
|
|
60
|
+
case taskbarElements.TaskbarElement.INSERT:
|
|
61
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleInsert", {});
|
|
62
|
+
case taskbarElements.TaskbarElement.CANCEL:
|
|
63
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleCancel", {});
|
|
64
|
+
case taskbarElements.TaskbarElement.SAVE:
|
|
65
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleSave", {});
|
|
66
|
+
case taskbarElements.TaskbarElement.GRID_MODE:
|
|
67
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleGridMode", {});
|
|
68
|
+
case taskbarElements.TaskbarElement.CONFIG_GRID:
|
|
69
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleConfigGrid", {});
|
|
70
|
+
case taskbarElements.TaskbarElement.FORM_MODE:
|
|
71
|
+
return this._application.messagesBuilder.getMessage("snkTaskbar.titleFormMode", {});
|
|
72
|
+
}
|
|
73
|
+
return "";
|
|
74
|
+
}
|
|
75
|
+
elementClick(elem) {
|
|
76
|
+
if (this.dataUnit) {
|
|
77
|
+
switch (elem) {
|
|
78
|
+
case taskbarElements.TaskbarElement.PREVIOUS:
|
|
79
|
+
this.dataUnit.previousRecord();
|
|
80
|
+
break;
|
|
81
|
+
case taskbarElements.TaskbarElement.NEXT:
|
|
82
|
+
this.dataUnit.nextRecord();
|
|
83
|
+
break;
|
|
84
|
+
case taskbarElements.TaskbarElement.REFRESH:
|
|
85
|
+
this.dataUnit.loadData();
|
|
86
|
+
break;
|
|
87
|
+
case taskbarElements.TaskbarElement.CLONE:
|
|
88
|
+
this.dataUnit.copySelected();
|
|
89
|
+
break;
|
|
90
|
+
case taskbarElements.TaskbarElement.REMOVE:
|
|
91
|
+
this.dataUnit.removeSelectedRecords();
|
|
92
|
+
break;
|
|
93
|
+
case taskbarElements.TaskbarElement.INSERT:
|
|
94
|
+
this.dataUnit.addRecord();
|
|
95
|
+
break;
|
|
96
|
+
case taskbarElements.TaskbarElement.CANCEL:
|
|
97
|
+
this.dataUnit.cancelEdition();
|
|
98
|
+
break;
|
|
99
|
+
case taskbarElements.TaskbarElement.SAVE:
|
|
100
|
+
this.dataUnit.saveData();
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
this.actionClick.emit(elem);
|
|
105
|
+
}
|
|
106
|
+
isEnabled(elem) {
|
|
107
|
+
return !(this.disabledButtons && this.disabledButtons.includes(elem));
|
|
108
|
+
}
|
|
109
|
+
getElement(index, def) {
|
|
110
|
+
let element;
|
|
111
|
+
let className = def === this.primaryButton ? "ez-button--primary " : "";
|
|
112
|
+
if (index > 1) {
|
|
113
|
+
className += "ez-padding-left--medium";
|
|
114
|
+
}
|
|
115
|
+
element = taskbarElements.buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
116
|
+
return element;
|
|
117
|
+
}
|
|
118
|
+
// Lifecycle
|
|
119
|
+
componentWillLoad() {
|
|
120
|
+
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
121
|
+
if (this._application) {
|
|
122
|
+
this._application.getAllAccess().then(access => this._permissions = access);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
this._permissions = {};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
componentWillRender() {
|
|
129
|
+
if (this._definitions == undefined && this._permissions) {
|
|
130
|
+
this._definitions = this.elementsFromString(this.buttons);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
render() {
|
|
134
|
+
if (this._definitions === undefined) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
let index$1 = 0;
|
|
138
|
+
return (index.h(index.Host, null, this._definitions.map((btn) => {
|
|
139
|
+
if (btn === taskbarElements.TaskbarElement.DIVIDER) {
|
|
140
|
+
index$1 = 0;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
index$1++;
|
|
144
|
+
}
|
|
145
|
+
if (taskbarElements.TaskbarElement[btn]) {
|
|
146
|
+
return this.getElement(index$1, taskbarElements.TaskbarElement[btn]);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
return index.h("slot", { name: btn });
|
|
150
|
+
}
|
|
151
|
+
})));
|
|
152
|
+
}
|
|
153
|
+
static get watchers() { return {
|
|
154
|
+
"buttons": ["observeButtons"]
|
|
155
|
+
}; }
|
|
156
|
+
};
|
|
157
|
+
SnkTaskbar.style = snkTaskbarCss;
|
|
158
|
+
|
|
159
|
+
exports.snk_taskbar = SnkTaskbar;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-c6671817.js');
|
|
4
|
+
|
|
5
|
+
exports.TaskbarElement = void 0;
|
|
6
|
+
(function (TaskbarElement) {
|
|
7
|
+
TaskbarElement["PREVIOUS"] = "PREVIOUS";
|
|
8
|
+
TaskbarElement["NEXT"] = "NEXT";
|
|
9
|
+
TaskbarElement["REFRESH"] = "REFRESH";
|
|
10
|
+
TaskbarElement["UPDATE"] = "UPDATE";
|
|
11
|
+
TaskbarElement["CLONE"] = "CLONE";
|
|
12
|
+
TaskbarElement["REMOVE"] = "REMOVE";
|
|
13
|
+
TaskbarElement["INSERT"] = "INSERT";
|
|
14
|
+
TaskbarElement["CANCEL"] = "CANCEL";
|
|
15
|
+
TaskbarElement["SAVE"] = "SAVE";
|
|
16
|
+
TaskbarElement["GRID_MODE"] = "GRID_MODE";
|
|
17
|
+
TaskbarElement["FORM_MODE"] = "FORM_MODE";
|
|
18
|
+
TaskbarElement["CONFIG_GRID"] = "CONFIG_GRID";
|
|
19
|
+
TaskbarElement["MORE_OPTIONS"] = "MORE_OPTIONS";
|
|
20
|
+
TaskbarElement["DIVIDER"] = "DIVIDER";
|
|
21
|
+
})(exports.TaskbarElement || (exports.TaskbarElement = {}));
|
|
22
|
+
exports.AuthorizationElements = void 0;
|
|
23
|
+
(function (AuthorizationElements) {
|
|
24
|
+
AuthorizationElements["UPDATE"] = "UPDATE";
|
|
25
|
+
AuthorizationElements["CLONE"] = "CLONE";
|
|
26
|
+
AuthorizationElements["REMOVE"] = "REMOVE";
|
|
27
|
+
AuthorizationElements["INSERT"] = "INSERT";
|
|
28
|
+
AuthorizationElements["CONFIG_GRID"] = "CONFIG_GRID";
|
|
29
|
+
})(exports.AuthorizationElements || (exports.AuthorizationElements = {}));
|
|
30
|
+
const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
|
|
31
|
+
switch (element) {
|
|
32
|
+
case exports.TaskbarElement.PREVIOUS:
|
|
33
|
+
return iconButton("chevron-left", element, className, getTitle, action, isEnabled);
|
|
34
|
+
case exports.TaskbarElement.NEXT:
|
|
35
|
+
return iconButton("chevron-right", element, className, getTitle, action, isEnabled);
|
|
36
|
+
case exports.TaskbarElement.REFRESH:
|
|
37
|
+
return iconButton("sync", element, className, getTitle, action, isEnabled);
|
|
38
|
+
case exports.TaskbarElement.UPDATE:
|
|
39
|
+
return iconButton("edit", element, className, getTitle, action, isEnabled);
|
|
40
|
+
case exports.TaskbarElement.CLONE:
|
|
41
|
+
return iconButton("copy", element, className, getTitle, action, isEnabled);
|
|
42
|
+
case exports.TaskbarElement.REMOVE:
|
|
43
|
+
return iconButton("delete", element, className, getTitle, action, isEnabled);
|
|
44
|
+
case exports.TaskbarElement.INSERT:
|
|
45
|
+
return iconTextButton("plus", element, className, getTitle, action, isEnabled);
|
|
46
|
+
case exports.TaskbarElement.CANCEL:
|
|
47
|
+
return index.h("ez-button", { title: getTitle(element), label: getTitle(element), size: "small", enabled: isEnabled(element), onClick: () => action(element) });
|
|
48
|
+
case exports.TaskbarElement.SAVE:
|
|
49
|
+
return iconTextButton("save", element, className, getTitle, action, isEnabled);
|
|
50
|
+
case exports.TaskbarElement.GRID_MODE:
|
|
51
|
+
return iconButton("table", element, className, getTitle, action, isEnabled);
|
|
52
|
+
case exports.TaskbarElement.FORM_MODE:
|
|
53
|
+
return iconButton("list", element, className, getTitle, action, isEnabled);
|
|
54
|
+
case exports.TaskbarElement.CONFIG_GRID:
|
|
55
|
+
return iconButton("settings-inverted", element, className, getTitle, action, isEnabled);
|
|
56
|
+
case exports.TaskbarElement.MORE_OPTIONS:
|
|
57
|
+
return actions && actions.length > 0 ? index.h("ez-actions-button", { title: getTitle(element), size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions }) : undefined;
|
|
58
|
+
case exports.TaskbarElement.DIVIDER:
|
|
59
|
+
return index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
function iconButton(iconName, element, className, getTitle, action, isEnabled) {
|
|
63
|
+
return index.h("ez-button", { key: iconName, title: getTitle(element), mode: "icon", size: "small", class: className, iconName: iconName, enabled: isEnabled(element), onClick: () => action(element) });
|
|
64
|
+
}
|
|
65
|
+
function iconTextButton(iconName, element, className, getTitle, action, isEnabled) {
|
|
66
|
+
return index.h("ez-button", { key: iconName, title: getTitle(element), label: getTitle(element), size: "small", class: className, enabled: isEnabled(element), onClick: () => action(element) },
|
|
67
|
+
index.h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exports.buildElem = buildElem;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
3
|
"./components/snk-application/snk-application.js",
|
|
4
|
+
"./components/snk-data-unit/snk-data-unit.js",
|
|
5
|
+
"./components/snk-taskbar/snk-taskbar.js",
|
|
6
|
+
"./components/snk-crud/snk-crud.js",
|
|
7
|
+
"./components/snk-form/snk-form.js",
|
|
8
|
+
"./components/snk-grid/snk-grid.js",
|
|
4
9
|
"./components/snk-pesquisa/snk-pesquisa.js",
|
|
5
10
|
"./components/teste-pesquisa/teste-pesquisa.js"
|
|
6
11
|
],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WarningException, WaitingChangeException, ErrorException } from "@sankhyalabs/core";
|
|
1
|
+
import { WarningException, WaitingChangeException, ErrorException, ObjectUtils } from "@sankhyalabs/core";
|
|
2
2
|
export class SnkErrorHandler {
|
|
3
3
|
constructor(app) {
|
|
4
4
|
this._app = app;
|
|
@@ -43,7 +43,7 @@ export class SnkErrorHandler {
|
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
45
|
const title = (exception === null || exception === void 0 ? void 0 : exception.title) || "Erro detectado";
|
|
46
|
-
const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${exception}"`;
|
|
46
|
+
const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${ObjectUtils.objectToString(exception)}"`;
|
|
47
47
|
this._app.error(title, message);
|
|
48
48
|
}
|
|
49
49
|
}
|