@sankhyalabs/sankhyablocks 1.3.31-beta.1 → 1.3.31-beta.10
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/{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 +280 -107
- package/dist/cjs/snk-crud.cjs.entry.js +64 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +218 -0
- package/dist/cjs/snk-form_2.cjs.entry.js +170 -0
- package/dist/cjs/snk-pesquisa.cjs.entry.js +6 -3
- package/dist/cjs/snk-taskbar.cjs.entry.js +140 -0
- package/dist/cjs/taskbar-elements-7f99f0c9.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 +237 -62
- package/dist/collection/components/snk-crud/snk-crud.css +5 -0
- package/dist/collection/components/snk-crud/snk-crud.js +149 -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 +492 -0
- package/dist/collection/components/snk-form/snk-form.css +34 -0
- package/dist/collection/components/snk-form/snk-form.js +230 -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 +252 -0
- 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/components/snk-application2.js +280 -106
- package/dist/components/snk-crud.d.ts +11 -0
- package/dist/components/snk-crud.js +102 -0
- package/dist/components/snk-data-unit.d.ts +11 -0
- package/dist/components/snk-data-unit.js +242 -0
- package/dist/components/snk-form.d.ts +11 -0
- package/dist/components/snk-form.js +6 -0
- package/dist/components/snk-form2.js +134 -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 +221 -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 +280 -107
- package/dist/esm/snk-crud.entry.js +60 -0
- package/dist/esm/snk-data-unit.entry.js +214 -0
- package/dist/esm/snk-form_2.entry.js +165 -0
- package/dist/esm/snk-pesquisa.entry.js +6 -3
- package/dist/esm/snk-taskbar.entry.js +136 -0
- package/dist/esm/taskbar-elements-e0b8a285.js +68 -0
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/p-18fe0469.entry.js +69 -0
- package/dist/sankhyablocks/p-4c7b32d6.entry.js +1 -0
- package/dist/sankhyablocks/p-5b5afdbe.entry.js +1 -0
- package/dist/sankhyablocks/p-7fe9e5c2.entry.js +1 -0
- package/dist/sankhyablocks/p-8650ae26.entry.js +1 -0
- package/dist/sankhyablocks/p-a5439706.js +1 -0
- package/dist/sankhyablocks/p-c3d20542.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/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +103 -15
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +25 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +45 -0
- package/dist/types/components.d.ts +381 -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/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
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-c6671817.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
|
-
const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
9
8
|
|
|
10
9
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
11
10
|
|
|
@@ -1236,7 +1235,7 @@ function isNode(maybeNode) {
|
|
|
1236
1235
|
}
|
|
1237
1236
|
/** Name */
|
|
1238
1237
|
|
|
1239
|
-
|
|
1238
|
+
var OperationTypeNode;
|
|
1240
1239
|
exports.OperationTypeNode = OperationTypeNode;
|
|
1241
1240
|
|
|
1242
1241
|
(function (OperationTypeNode) {
|
|
@@ -1256,13 +1255,7 @@ exports.DirectiveLocation = void 0;
|
|
|
1256
1255
|
/**
|
|
1257
1256
|
* The set of allowed directive location values.
|
|
1258
1257
|
*/
|
|
1259
|
-
|
|
1260
|
-
/**
|
|
1261
|
-
* The enum type representing the directive location values.
|
|
1262
|
-
*
|
|
1263
|
-
* @deprecated Please use `DirectiveLocation`. Will be remove in v17.
|
|
1264
|
-
*/
|
|
1265
|
-
|
|
1258
|
+
var DirectiveLocation;
|
|
1266
1259
|
exports.DirectiveLocation = DirectiveLocation;
|
|
1267
1260
|
|
|
1268
1261
|
(function (DirectiveLocation) {
|
|
@@ -1286,6 +1279,11 @@ exports.DirectiveLocation = DirectiveLocation;
|
|
|
1286
1279
|
DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';
|
|
1287
1280
|
DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';
|
|
1288
1281
|
})(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {}));
|
|
1282
|
+
/**
|
|
1283
|
+
* The enum type representing the directive location values.
|
|
1284
|
+
*
|
|
1285
|
+
* @deprecated Please use `DirectiveLocation`. Will be remove in v17.
|
|
1286
|
+
*/
|
|
1289
1287
|
});
|
|
1290
1288
|
|
|
1291
1289
|
var kinds = createCommonjsModule(function (module, exports) {
|
|
@@ -1298,13 +1296,7 @@ exports.Kind = void 0;
|
|
|
1298
1296
|
/**
|
|
1299
1297
|
* The set of allowed kind values for AST nodes.
|
|
1300
1298
|
*/
|
|
1301
|
-
|
|
1302
|
-
/**
|
|
1303
|
-
* The enum type representing the possible kind values of AST nodes.
|
|
1304
|
-
*
|
|
1305
|
-
* @deprecated Please use `Kind`. Will be remove in v17.
|
|
1306
|
-
*/
|
|
1307
|
-
|
|
1299
|
+
var Kind;
|
|
1308
1300
|
exports.Kind = Kind;
|
|
1309
1301
|
|
|
1310
1302
|
(function (Kind) {
|
|
@@ -1352,6 +1344,11 @@ exports.Kind = Kind;
|
|
|
1352
1344
|
Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';
|
|
1353
1345
|
Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';
|
|
1354
1346
|
})(Kind || (exports.Kind = Kind = {}));
|
|
1347
|
+
/**
|
|
1348
|
+
* The enum type representing the possible kind values of AST nodes.
|
|
1349
|
+
*
|
|
1350
|
+
* @deprecated Please use `Kind`. Will be remove in v17.
|
|
1351
|
+
*/
|
|
1355
1352
|
});
|
|
1356
1353
|
|
|
1357
1354
|
var characterClasses = createCommonjsModule(function (module, exports) {
|
|
@@ -1639,13 +1636,7 @@ exports.TokenKind = void 0;
|
|
|
1639
1636
|
* An exported enum describing the different kinds of tokens that the
|
|
1640
1637
|
* lexer emits.
|
|
1641
1638
|
*/
|
|
1642
|
-
|
|
1643
|
-
/**
|
|
1644
|
-
* The enum type representing the token kinds values.
|
|
1645
|
-
*
|
|
1646
|
-
* @deprecated Please use `TokenKind`. Will be remove in v17.
|
|
1647
|
-
*/
|
|
1648
|
-
|
|
1639
|
+
var TokenKind;
|
|
1649
1640
|
exports.TokenKind = TokenKind;
|
|
1650
1641
|
|
|
1651
1642
|
(function (TokenKind) {
|
|
@@ -1672,6 +1663,11 @@ exports.TokenKind = TokenKind;
|
|
|
1672
1663
|
TokenKind['BLOCK_STRING'] = 'BlockString';
|
|
1673
1664
|
TokenKind['COMMENT'] = 'Comment';
|
|
1674
1665
|
})(TokenKind || (exports.TokenKind = TokenKind = {}));
|
|
1666
|
+
/**
|
|
1667
|
+
* The enum type representing the token kinds values.
|
|
1668
|
+
*
|
|
1669
|
+
* @deprecated Please use `TokenKind`. Will be remove in v17.
|
|
1670
|
+
*/
|
|
1675
1671
|
});
|
|
1676
1672
|
|
|
1677
1673
|
var lexer = createCommonjsModule(function (module, exports) {
|
|
@@ -3008,12 +3004,13 @@ function parseType(source, options) {
|
|
|
3008
3004
|
*/
|
|
3009
3005
|
|
|
3010
3006
|
class Parser {
|
|
3011
|
-
constructor(source$1, options) {
|
|
3007
|
+
constructor(source$1, options = {}) {
|
|
3012
3008
|
const sourceObj = (0, source.isSource)(source$1)
|
|
3013
3009
|
? source$1
|
|
3014
3010
|
: new source.Source(source$1);
|
|
3015
3011
|
this._lexer = new lexer.Lexer(sourceObj);
|
|
3016
3012
|
this._options = options;
|
|
3013
|
+
this._tokenCounter = 0;
|
|
3017
3014
|
}
|
|
3018
3015
|
/**
|
|
3019
3016
|
* Converts a name lex token into a name parse node.
|
|
@@ -3348,18 +3345,12 @@ class Parser {
|
|
|
3348
3345
|
*/
|
|
3349
3346
|
|
|
3350
3347
|
parseFragmentDefinition() {
|
|
3351
|
-
var _this$_options;
|
|
3352
|
-
|
|
3353
3348
|
const start = this._lexer.token;
|
|
3354
3349
|
this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes
|
|
3355
3350
|
// the grammar of FragmentDefinition:
|
|
3356
3351
|
// - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet
|
|
3357
3352
|
|
|
3358
|
-
if (
|
|
3359
|
-
((_this$_options = this._options) === null || _this$_options === void 0
|
|
3360
|
-
? void 0
|
|
3361
|
-
: _this$_options.allowLegacyFragmentVariables) === true
|
|
3362
|
-
) {
|
|
3353
|
+
if (this._options.allowLegacyFragmentVariables === true) {
|
|
3363
3354
|
return this.node(start, {
|
|
3364
3355
|
kind: kinds.Kind.FRAGMENT_DEFINITION,
|
|
3365
3356
|
name: this.parseFragmentName(),
|
|
@@ -3420,16 +3411,14 @@ class Parser {
|
|
|
3420
3411
|
return this.parseObject(isConst);
|
|
3421
3412
|
|
|
3422
3413
|
case tokenKind.TokenKind.INT:
|
|
3423
|
-
this.
|
|
3424
|
-
|
|
3414
|
+
this.advanceLexer();
|
|
3425
3415
|
return this.node(token, {
|
|
3426
3416
|
kind: kinds.Kind.INT,
|
|
3427
3417
|
value: token.value,
|
|
3428
3418
|
});
|
|
3429
3419
|
|
|
3430
3420
|
case tokenKind.TokenKind.FLOAT:
|
|
3431
|
-
this.
|
|
3432
|
-
|
|
3421
|
+
this.advanceLexer();
|
|
3433
3422
|
return this.node(token, {
|
|
3434
3423
|
kind: kinds.Kind.FLOAT,
|
|
3435
3424
|
value: token.value,
|
|
@@ -3440,7 +3429,7 @@ class Parser {
|
|
|
3440
3429
|
return this.parseStringLiteral();
|
|
3441
3430
|
|
|
3442
3431
|
case tokenKind.TokenKind.NAME:
|
|
3443
|
-
this.
|
|
3432
|
+
this.advanceLexer();
|
|
3444
3433
|
|
|
3445
3434
|
switch (token.value) {
|
|
3446
3435
|
case 'true':
|
|
@@ -3496,9 +3485,7 @@ class Parser {
|
|
|
3496
3485
|
|
|
3497
3486
|
parseStringLiteral() {
|
|
3498
3487
|
const token = this._lexer.token;
|
|
3499
|
-
|
|
3500
|
-
this._lexer.advance();
|
|
3501
|
-
|
|
3488
|
+
this.advanceLexer();
|
|
3502
3489
|
return this.node(token, {
|
|
3503
3490
|
kind: kinds.Kind.STRING,
|
|
3504
3491
|
value: token.value,
|
|
@@ -4289,13 +4276,7 @@ class Parser {
|
|
|
4289
4276
|
*/
|
|
4290
4277
|
|
|
4291
4278
|
node(startToken, node) {
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
if (
|
|
4295
|
-
((_this$_options2 = this._options) === null || _this$_options2 === void 0
|
|
4296
|
-
? void 0
|
|
4297
|
-
: _this$_options2.noLocation) !== true
|
|
4298
|
-
) {
|
|
4279
|
+
if (this._options.noLocation !== true) {
|
|
4299
4280
|
node.loc = new ast.Location(
|
|
4300
4281
|
startToken,
|
|
4301
4282
|
this._lexer.lastToken,
|
|
@@ -4321,8 +4302,7 @@ class Parser {
|
|
|
4321
4302
|
const token = this._lexer.token;
|
|
4322
4303
|
|
|
4323
4304
|
if (token.kind === kind) {
|
|
4324
|
-
this.
|
|
4325
|
-
|
|
4305
|
+
this.advanceLexer();
|
|
4326
4306
|
return token;
|
|
4327
4307
|
}
|
|
4328
4308
|
|
|
@@ -4341,8 +4321,7 @@ class Parser {
|
|
|
4341
4321
|
const token = this._lexer.token;
|
|
4342
4322
|
|
|
4343
4323
|
if (token.kind === kind) {
|
|
4344
|
-
this.
|
|
4345
|
-
|
|
4324
|
+
this.advanceLexer();
|
|
4346
4325
|
return true;
|
|
4347
4326
|
}
|
|
4348
4327
|
|
|
@@ -4357,7 +4336,7 @@ class Parser {
|
|
|
4357
4336
|
const token = this._lexer.token;
|
|
4358
4337
|
|
|
4359
4338
|
if (token.kind === tokenKind.TokenKind.NAME && token.value === value) {
|
|
4360
|
-
this.
|
|
4339
|
+
this.advanceLexer();
|
|
4361
4340
|
} else {
|
|
4362
4341
|
throw (0, syntaxError_1.syntaxError)(
|
|
4363
4342
|
this._lexer.source,
|
|
@@ -4375,8 +4354,7 @@ class Parser {
|
|
|
4375
4354
|
const token = this._lexer.token;
|
|
4376
4355
|
|
|
4377
4356
|
if (token.kind === tokenKind.TokenKind.NAME && token.value === value) {
|
|
4378
|
-
this.
|
|
4379
|
-
|
|
4357
|
+
this.advanceLexer();
|
|
4380
4358
|
return true;
|
|
4381
4359
|
}
|
|
4382
4360
|
|
|
@@ -4463,6 +4441,24 @@ class Parser {
|
|
|
4463
4441
|
|
|
4464
4442
|
return nodes;
|
|
4465
4443
|
}
|
|
4444
|
+
|
|
4445
|
+
advanceLexer() {
|
|
4446
|
+
const { maxTokens } = this._options;
|
|
4447
|
+
|
|
4448
|
+
const token = this._lexer.advance();
|
|
4449
|
+
|
|
4450
|
+
if (maxTokens !== undefined && token.kind !== tokenKind.TokenKind.EOF) {
|
|
4451
|
+
++this._tokenCounter;
|
|
4452
|
+
|
|
4453
|
+
if (this._tokenCounter > maxTokens) {
|
|
4454
|
+
throw (0, syntaxError_1.syntaxError)(
|
|
4455
|
+
this._lexer.source,
|
|
4456
|
+
token.start,
|
|
4457
|
+
`Document contains more that ${maxTokens} tokens. Parsing aborted.`,
|
|
4458
|
+
);
|
|
4459
|
+
}
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4466
4462
|
}
|
|
4467
4463
|
/**
|
|
4468
4464
|
* A helper function to describe a token as a string for debugging.
|
|
@@ -6695,6 +6691,7 @@ class WaitingRequest {
|
|
|
6695
6691
|
class DataUnitFetcher {
|
|
6696
6692
|
constructor() {
|
|
6697
6693
|
this.templateByQuery = new Map();
|
|
6694
|
+
this._loadDataTimeout = {};
|
|
6698
6695
|
this.buldTemplates();
|
|
6699
6696
|
}
|
|
6700
6697
|
buldTemplates() {
|
|
@@ -6723,9 +6720,9 @@ class DataUnitFetcher {
|
|
|
6723
6720
|
}
|
|
6724
6721
|
}
|
|
6725
6722
|
}`);
|
|
6726
|
-
this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $
|
|
6723
|
+
this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filters: [InputFilter!] $sort: [InputSort!]) {
|
|
6727
6724
|
$queryAlias$: fetchDataUnit(name: $dataunit){
|
|
6728
|
-
data(limit: $limit offset: $offset filters: $
|
|
6725
|
+
data(limit: $limit offset: $offset filters: $filters sort: $sort){
|
|
6729
6726
|
limit
|
|
6730
6727
|
offset
|
|
6731
6728
|
total
|
|
@@ -6754,7 +6751,7 @@ class DataUnitFetcher {
|
|
|
6754
6751
|
getDataUnit(entityName, resourceID) {
|
|
6755
6752
|
const dataUnit = new core.DataUnit(`dd://${entityName}/${resourceID}`);
|
|
6756
6753
|
dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
|
|
6757
|
-
dataUnit.dataLoader = (dataUnit,
|
|
6754
|
+
dataUnit.dataLoader = (dataUnit, request) => this.loadData(dataUnit, request);
|
|
6758
6755
|
dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
|
|
6759
6756
|
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
|
6760
6757
|
return dataUnit;
|
|
@@ -6791,25 +6788,39 @@ class DataUnitFetcher {
|
|
|
6791
6788
|
});
|
|
6792
6789
|
});
|
|
6793
6790
|
}
|
|
6794
|
-
loadData(dataUnit,
|
|
6791
|
+
loadData(dataUnit, request) {
|
|
6792
|
+
const duName = dataUnit.name;
|
|
6793
|
+
if (this._loadDataTimeout[duName]) {
|
|
6794
|
+
clearTimeout(this._loadDataTimeout[duName]);
|
|
6795
|
+
delete this._loadDataTimeout[duName];
|
|
6796
|
+
}
|
|
6795
6797
|
return new Promise((resolve, reject) => {
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
}
|
|
6802
|
-
|
|
6798
|
+
this._loadDataTimeout[duName] = setTimeout(() => {
|
|
6799
|
+
delete this._loadDataTimeout[duName];
|
|
6800
|
+
this.doLoadData(dataUnit, request)
|
|
6801
|
+
.then(result => resolve(result))
|
|
6802
|
+
.catch(reason => reject(reason));
|
|
6803
|
+
}, 200);
|
|
6804
|
+
});
|
|
6805
|
+
}
|
|
6806
|
+
doLoadData(dataUnit, request) {
|
|
6807
|
+
return new Promise((resolve, reject) => {
|
|
6808
|
+
var _a;
|
|
6809
|
+
const { sort, filters, limit, offset, quickFilter } = request;
|
|
6810
|
+
const variables = { dataunit: dataUnit.name, sort, filters };
|
|
6811
|
+
variables.limit = limit;
|
|
6812
|
+
variables.offset = offset;
|
|
6813
|
+
if (!core.StringUtils.isEmpty(quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.term)) {
|
|
6803
6814
|
if (variables.filter === undefined) {
|
|
6804
6815
|
variables.filter = [];
|
|
6805
6816
|
}
|
|
6806
6817
|
const quickFilterCriteria = {
|
|
6807
6818
|
name: "__QUICK_FILTER__",
|
|
6808
6819
|
expression: "__QUICK_FILTER__",
|
|
6809
|
-
params: [{ name: "term", dataType: core.DataType.TEXT, value:
|
|
6820
|
+
params: [{ name: "term", dataType: core.DataType.TEXT, value: quickFilter.term }]
|
|
6810
6821
|
};
|
|
6811
|
-
if (((
|
|
6812
|
-
quickFilterCriteria.params.push({ name: "fields", dataType: core.DataType.OBJECT, value:
|
|
6822
|
+
if (((_a = quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.fields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
6823
|
+
quickFilterCriteria.params.push({ name: "fields", dataType: core.DataType.OBJECT, value: quickFilter.fields });
|
|
6813
6824
|
}
|
|
6814
6825
|
variables.filter.push(quickFilterCriteria);
|
|
6815
6826
|
}
|
|
@@ -6819,16 +6830,32 @@ class DataUnitFetcher {
|
|
|
6819
6830
|
query: this.templateByQuery.get("fetchData"),
|
|
6820
6831
|
})
|
|
6821
6832
|
.then((resp) => {
|
|
6822
|
-
const
|
|
6823
|
-
|
|
6824
|
-
|
|
6833
|
+
const { limit, offset, total, hasMore, records } = resp.data;
|
|
6834
|
+
let paginationInfo;
|
|
6835
|
+
if (limit) {
|
|
6836
|
+
const firstRecord = offset + 1;
|
|
6837
|
+
const lastRecord = offset + Math.min(records.length, limit);
|
|
6838
|
+
const currentPage = offset / limit;
|
|
6839
|
+
paginationInfo = {
|
|
6840
|
+
firstRecord,
|
|
6841
|
+
lastRecord,
|
|
6842
|
+
total,
|
|
6843
|
+
currentPage,
|
|
6844
|
+
hasMore
|
|
6845
|
+
};
|
|
6846
|
+
}
|
|
6847
|
+
const processedRecords = [];
|
|
6848
|
+
records.forEach((responseRecord) => {
|
|
6825
6849
|
const duRecord = { __record__id__: responseRecord.id };
|
|
6826
6850
|
responseRecord.fields.forEach(({ name, value }) => {
|
|
6827
6851
|
duRecord[name] = dataUnit.valueFromString(name, value);
|
|
6828
6852
|
});
|
|
6829
|
-
|
|
6853
|
+
processedRecords.push(duRecord);
|
|
6854
|
+
});
|
|
6855
|
+
resolve({
|
|
6856
|
+
paginationInfo,
|
|
6857
|
+
records: processedRecords
|
|
6830
6858
|
});
|
|
6831
|
-
resolve(Object.assign(Object.assign({}, pageResult), { records }));
|
|
6832
6859
|
})
|
|
6833
6860
|
.catch((error) => {
|
|
6834
6861
|
reject(error);
|
|
@@ -7054,15 +7081,16 @@ class GridConfigFetcher extends ResourceFetcher {
|
|
|
7054
7081
|
super(...arguments);
|
|
7055
7082
|
this.GRID_CONFIG_VERSION = "V3:";
|
|
7056
7083
|
}
|
|
7057
|
-
getConfig(resourceID) {
|
|
7084
|
+
getConfig(_gridName, resourceID) {
|
|
7058
7085
|
const completePath = `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
|
|
7059
7086
|
return new Promise((resolve, reject) => {
|
|
7060
7087
|
this.loadResource(completePath)
|
|
7061
7088
|
.then(loadedResource => {
|
|
7089
|
+
let config = undefined;
|
|
7062
7090
|
if (loadedResource) {
|
|
7063
|
-
|
|
7064
|
-
resolve(config);
|
|
7091
|
+
config = JSON.parse(loadedResource);
|
|
7065
7092
|
}
|
|
7093
|
+
resolve(config);
|
|
7066
7094
|
}).catch((error) => {
|
|
7067
7095
|
reject(error);
|
|
7068
7096
|
});
|
|
@@ -7097,6 +7125,8 @@ class PesquisaFetcher {
|
|
|
7097
7125
|
}`);
|
|
7098
7126
|
}
|
|
7099
7127
|
loadSearchOptions(entityName, argument, criteria, options) {
|
|
7128
|
+
const cleanText = (argument === null || argument === void 0 ? void 0 : argument.trim()) || undefined;
|
|
7129
|
+
argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
|
|
7100
7130
|
return new Promise((resolve, reject) => {
|
|
7101
7131
|
DataFetcher.get()
|
|
7102
7132
|
.callGraphQL({
|
|
@@ -7237,7 +7267,7 @@ class SnkErrorHandler {
|
|
|
7237
7267
|
}
|
|
7238
7268
|
else {
|
|
7239
7269
|
const title = (exception === null || exception === void 0 ? void 0 : exception.title) || "Erro detectado";
|
|
7240
|
-
const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${exception}"`;
|
|
7270
|
+
const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${core.ObjectUtils.objectToString(exception)}"`;
|
|
7241
7271
|
this._app.error(title, message);
|
|
7242
7272
|
}
|
|
7243
7273
|
}
|
|
@@ -7255,6 +7285,9 @@ const SnkApplication = class {
|
|
|
7255
7285
|
index.registerInstance(this, hostRef);
|
|
7256
7286
|
this.applicationLoaded = index.createEvent(this, "applicationLoaded", 7);
|
|
7257
7287
|
this.applicationLoading = index.createEvent(this, "applicationLoading", 7);
|
|
7288
|
+
this._authPromises = [];
|
|
7289
|
+
this._duCache = new Map();
|
|
7290
|
+
this._duPromises = new Map();
|
|
7258
7291
|
this._requestListener = new RequestListenerLoadingBar();
|
|
7259
7292
|
}
|
|
7260
7293
|
get parameters() {
|
|
@@ -7273,18 +7306,31 @@ const SnkApplication = class {
|
|
|
7273
7306
|
return this._resourceID;
|
|
7274
7307
|
}
|
|
7275
7308
|
get auth() {
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
this.
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7309
|
+
if (this._auth) {
|
|
7310
|
+
return Promise.resolve(this._auth);
|
|
7311
|
+
}
|
|
7312
|
+
else {
|
|
7313
|
+
return new Promise((resolve, reject) => {
|
|
7314
|
+
const waitingAuth = this._authPromises.length > 0;
|
|
7315
|
+
this._authPromises.push(new PendingPromise(resolve, reject));
|
|
7316
|
+
if (!waitingAuth) {
|
|
7317
|
+
this.authFetcher.getData(this._resourceID).then((authList) => {
|
|
7318
|
+
this._auth = authList;
|
|
7319
|
+
while (this._authPromises.length > 0) {
|
|
7320
|
+
this._authPromises.pop().resolve(this._auth);
|
|
7321
|
+
}
|
|
7322
|
+
}).catch(error => {
|
|
7323
|
+
while (this._authPromises.length > 0) {
|
|
7324
|
+
this._authPromises.pop().reject(error);
|
|
7325
|
+
}
|
|
7326
|
+
});
|
|
7327
|
+
}
|
|
7328
|
+
});
|
|
7329
|
+
}
|
|
7287
7330
|
}
|
|
7331
|
+
/**
|
|
7332
|
+
* Caso o usuário logado seja o SUP.
|
|
7333
|
+
*/
|
|
7288
7334
|
async isUserSup() {
|
|
7289
7335
|
return new Promise((resolve, reject) => {
|
|
7290
7336
|
this.auth.then((authorization) => {
|
|
@@ -7294,6 +7340,9 @@ const SnkApplication = class {
|
|
|
7294
7340
|
});
|
|
7295
7341
|
});
|
|
7296
7342
|
}
|
|
7343
|
+
/**
|
|
7344
|
+
* Se o usuário logado tem permissão pra determinada ação.
|
|
7345
|
+
*/
|
|
7297
7346
|
async hasAccess(access) {
|
|
7298
7347
|
return new Promise((resolve, reject) => {
|
|
7299
7348
|
this.auth.then((authorization) => {
|
|
@@ -7303,6 +7352,9 @@ const SnkApplication = class {
|
|
|
7303
7352
|
});
|
|
7304
7353
|
});
|
|
7305
7354
|
}
|
|
7355
|
+
/**
|
|
7356
|
+
* Retorna todos os acessos do usuário logado.
|
|
7357
|
+
*/
|
|
7306
7358
|
async getAllAccess() {
|
|
7307
7359
|
return new Promise((resolve, reject) => {
|
|
7308
7360
|
this.auth.then((authorization) => {
|
|
@@ -7317,34 +7369,54 @@ const SnkApplication = class {
|
|
|
7317
7369
|
});
|
|
7318
7370
|
});
|
|
7319
7371
|
}
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7372
|
+
/**
|
|
7373
|
+
* Retorna o valor de um parâmetro do tipo string.
|
|
7374
|
+
*/
|
|
7323
7375
|
async getStringParam(name) {
|
|
7324
7376
|
return this.parameters.asString(name, this.resourceID);
|
|
7325
7377
|
}
|
|
7378
|
+
/**
|
|
7379
|
+
* Retorna o valor de um parâmetro do tipo Inteiro.
|
|
7380
|
+
*/
|
|
7326
7381
|
async getIntParam(name) {
|
|
7327
7382
|
return this.parameters.asInteger(name, this.resourceID);
|
|
7328
7383
|
}
|
|
7384
|
+
/**
|
|
7385
|
+
* Retorna o valor de um parâmetro do tipo Decimal.
|
|
7386
|
+
*/
|
|
7329
7387
|
async getFloatParam(name) {
|
|
7330
7388
|
return this.parameters.asFloat(name, this.resourceID);
|
|
7331
7389
|
}
|
|
7390
|
+
/**
|
|
7391
|
+
* Retorna o valor de um parâmetro do tipo booleano.
|
|
7392
|
+
*/
|
|
7332
7393
|
async getBooleanParam(name) {
|
|
7333
7394
|
return this.parameters.asBoolean(name, this.resourceID);
|
|
7334
7395
|
}
|
|
7396
|
+
/**
|
|
7397
|
+
* Retorna o valor de um parâmetro do tipo data.
|
|
7398
|
+
*/
|
|
7335
7399
|
async getDateParam(name) {
|
|
7336
7400
|
return this.parameters.asDate(name, this.resourceID);
|
|
7337
7401
|
}
|
|
7402
|
+
/**
|
|
7403
|
+
* Mostra o conteúdo passado em um Popup
|
|
7404
|
+
*/
|
|
7338
7405
|
async showPopUp(content) {
|
|
7406
|
+
this.clearPopUpContent();
|
|
7339
7407
|
this._popUp.appendChild(content);
|
|
7340
|
-
this._popUp
|
|
7408
|
+
this._popUp.opened = true;
|
|
7341
7409
|
}
|
|
7410
|
+
/**
|
|
7411
|
+
* Fecha o popup, liberando o conteúdo.
|
|
7412
|
+
*/
|
|
7342
7413
|
async closePopUp() {
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
});
|
|
7346
|
-
this._popUp["opened"] = false;
|
|
7414
|
+
this.clearPopUpContent();
|
|
7415
|
+
this._popUp.opened = false;
|
|
7347
7416
|
}
|
|
7417
|
+
/**
|
|
7418
|
+
* Verifica se a licença do cliente tem determinado opcional (produto)
|
|
7419
|
+
*/
|
|
7348
7420
|
async temOpcional(opcional) {
|
|
7349
7421
|
const opts = opcional.split(",");
|
|
7350
7422
|
return new Promise((resolve, reject) => {
|
|
@@ -7368,6 +7440,10 @@ const SnkApplication = class {
|
|
|
7368
7440
|
});
|
|
7369
7441
|
});
|
|
7370
7442
|
}
|
|
7443
|
+
/**
|
|
7444
|
+
* Retorna a configuração de um recurso por service broker
|
|
7445
|
+
* Veja também o método "loadConfig"
|
|
7446
|
+
*/
|
|
7371
7447
|
async getConfig(key) {
|
|
7372
7448
|
let payload = {
|
|
7373
7449
|
"serviceName": "SystemUtilsSP.getConf",
|
|
@@ -7385,6 +7461,9 @@ const SnkApplication = class {
|
|
|
7385
7461
|
.catch(error => reject(error));
|
|
7386
7462
|
});
|
|
7387
7463
|
}
|
|
7464
|
+
/**
|
|
7465
|
+
* Salva a configuração de determinado recurso.
|
|
7466
|
+
*/
|
|
7388
7467
|
async saveConfig(key, data) {
|
|
7389
7468
|
let payload = {
|
|
7390
7469
|
"serviceName": "SystemUtilsSP.saveConf",
|
|
@@ -7403,42 +7482,122 @@ const SnkApplication = class {
|
|
|
7403
7482
|
.catch(error => reject(error));
|
|
7404
7483
|
});
|
|
7405
7484
|
}
|
|
7485
|
+
/**
|
|
7486
|
+
* Acessa informações de contexto "empurrados" na abertura da tela
|
|
7487
|
+
*/
|
|
7406
7488
|
async getAttributeFromHTMLWrapper(attribName) {
|
|
7407
7489
|
return Promise.resolve(window[attribName]);
|
|
7408
7490
|
}
|
|
7491
|
+
/**
|
|
7492
|
+
* Abre determinada tela, repassando pkObject
|
|
7493
|
+
*/
|
|
7409
7494
|
async openApp(resourceId, pkObject) {
|
|
7410
7495
|
Workspace.openAppActivity(resourceId, pkObject);
|
|
7411
7496
|
}
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7497
|
+
getDuPromissesStack(dataUnitName) {
|
|
7498
|
+
let stack;
|
|
7499
|
+
if (dataUnitName) {
|
|
7500
|
+
stack = this._duPromises.get(dataUnitName);
|
|
7501
|
+
if (!stack) {
|
|
7502
|
+
stack = [];
|
|
7503
|
+
this._duPromises.set(dataUnitName, stack);
|
|
7504
|
+
}
|
|
7505
|
+
}
|
|
7506
|
+
return stack || [];
|
|
7507
|
+
}
|
|
7508
|
+
/**
|
|
7509
|
+
* Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
|
|
7510
|
+
* passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado
|
|
7511
|
+
*/
|
|
7512
|
+
async createDataunit(entityName, dataUnitName) {
|
|
7513
|
+
return new Promise((resolve, reject) => {
|
|
7514
|
+
const duPromisses = this.getDuPromissesStack(dataUnitName);
|
|
7515
|
+
const waitingDu = duPromisses.length > 0;
|
|
7516
|
+
duPromisses.push(new PendingPromise(resolve, reject));
|
|
7517
|
+
if (!waitingDu) {
|
|
7518
|
+
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
|
|
7519
|
+
dataUnit.loadMetadata().then(() => {
|
|
7520
|
+
if (dataUnitName) {
|
|
7521
|
+
this._duCache.set(dataUnitName, dataUnit);
|
|
7522
|
+
}
|
|
7523
|
+
while (duPromisses.length > 0) {
|
|
7524
|
+
duPromisses.pop().resolve(dataUnit);
|
|
7525
|
+
}
|
|
7526
|
+
}).catch(reason => {
|
|
7527
|
+
while (duPromisses.length > 0) {
|
|
7528
|
+
duPromisses.pop().reject(reason);
|
|
7529
|
+
}
|
|
7530
|
+
});
|
|
7531
|
+
}
|
|
7532
|
+
});
|
|
7533
|
+
}
|
|
7534
|
+
/**
|
|
7535
|
+
* Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
|
|
7536
|
+
*/
|
|
7537
|
+
async getDataUnit(entityName, dataUnitName) {
|
|
7538
|
+
return new Promise((resolve, reject) => {
|
|
7539
|
+
const dataUnit = this._duCache.get(dataUnitName);
|
|
7540
|
+
if (dataUnit) {
|
|
7541
|
+
resolve(dataUnit);
|
|
7542
|
+
}
|
|
7543
|
+
else {
|
|
7544
|
+
this.createDataunit(entityName, dataUnitName).then(dataUnit => {
|
|
7545
|
+
resolve(dataUnit);
|
|
7546
|
+
}).catch(reason => reject(reason));
|
|
7547
|
+
}
|
|
7416
7548
|
});
|
|
7417
7549
|
}
|
|
7550
|
+
/**
|
|
7551
|
+
* Retorna o resourceID da tela em questão.
|
|
7552
|
+
*/
|
|
7418
7553
|
async getResourceID() {
|
|
7419
7554
|
return Promise.resolve(this.resourceID);
|
|
7420
7555
|
}
|
|
7556
|
+
/**
|
|
7557
|
+
* Mostra o diálogo de alerta de acordo com os parâmetros passados.
|
|
7558
|
+
*/
|
|
7421
7559
|
async alert(title, message, icon, options) {
|
|
7422
7560
|
return utils.ApplicationUtils.alert(title, message, icon, options);
|
|
7423
7561
|
}
|
|
7562
|
+
/**
|
|
7563
|
+
* Mostra o diálogo de erro de acordo com os parâmetros passados.
|
|
7564
|
+
*/
|
|
7424
7565
|
async error(title, message, icon, options) {
|
|
7425
7566
|
return utils.ApplicationUtils.error(title, message, icon, options);
|
|
7426
7567
|
}
|
|
7568
|
+
/**
|
|
7569
|
+
* Exibe um diálogo de confirmação
|
|
7570
|
+
*/
|
|
7427
7571
|
async confirm(title, message, icon, critical, options) {
|
|
7428
7572
|
return utils.ApplicationUtils.confirm(title, message, icon, critical, options);
|
|
7429
7573
|
}
|
|
7574
|
+
/**
|
|
7575
|
+
* Mostra uma informação efêmera (de segundo plano).
|
|
7576
|
+
*/
|
|
7430
7577
|
async info(message, options) {
|
|
7431
7578
|
return utils.ApplicationUtils.info(message, options);
|
|
7432
7579
|
}
|
|
7580
|
+
/**
|
|
7581
|
+
* Busca a configuração de formulário.
|
|
7582
|
+
*/
|
|
7433
7583
|
async loadFormConfig(name) {
|
|
7434
7584
|
return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
|
|
7435
7585
|
}
|
|
7436
|
-
|
|
7437
|
-
|
|
7586
|
+
/**
|
|
7587
|
+
* Busca a configuração de grade.
|
|
7588
|
+
*/
|
|
7589
|
+
async loadGridConfig(name) {
|
|
7590
|
+
return this.gridConfigFetcher.getConfig(name, this.resourceID);
|
|
7438
7591
|
}
|
|
7592
|
+
/**
|
|
7593
|
+
* Salva a configuração de grade.
|
|
7594
|
+
*/
|
|
7439
7595
|
async saveGridConfig(config) {
|
|
7440
7596
|
return this.gridConfigFetcher.saveConfig(config, this.resourceID);
|
|
7441
7597
|
}
|
|
7598
|
+
async getAuthList(_auth) {
|
|
7599
|
+
return await (new MGEAuthorization()).parseFromJSON(_auth);
|
|
7600
|
+
}
|
|
7442
7601
|
get urlParams() {
|
|
7443
7602
|
if (!this._urlParams) {
|
|
7444
7603
|
this._urlParams = UrlUtils.getQueryParams(location.search);
|
|
@@ -7491,7 +7650,7 @@ const SnkApplication = class {
|
|
|
7491
7650
|
};
|
|
7492
7651
|
dependencies === null || dependencies === void 0 ? void 0 : dependencies.filter(dep => { var _a; return (_a = dep.masterFields) === null || _a === void 0 ? void 0 : _a.every(f => { var _a; return (_a = dataUnit.getField(f)) === null || _a === void 0 ? void 0 : _a.visible; }); }).forEach(dependency => {
|
|
7493
7652
|
var _a;
|
|
7494
|
-
if (dependency.type ===
|
|
7653
|
+
if (dependency.type === core.DependencyType.SEARCHING) {
|
|
7495
7654
|
if (((_a = dependency.masterFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
7496
7655
|
criteria = {
|
|
7497
7656
|
expression: dependency.expression,
|
|
@@ -7516,7 +7675,7 @@ const SnkApplication = class {
|
|
|
7516
7675
|
pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
|
|
7517
7676
|
pesquisaContent.selectItem = (option) => {
|
|
7518
7677
|
accept(option);
|
|
7519
|
-
this.
|
|
7678
|
+
this.clearPopUpTitle();
|
|
7520
7679
|
this.closePopUp();
|
|
7521
7680
|
};
|
|
7522
7681
|
this.setPopUpTitle(DESCRIPTIONENTITY);
|
|
@@ -7533,11 +7692,18 @@ const SnkApplication = class {
|
|
|
7533
7692
|
accept(window['isDebugMode']);
|
|
7534
7693
|
});
|
|
7535
7694
|
}
|
|
7536
|
-
|
|
7537
|
-
this._popUp
|
|
7695
|
+
clearPopUpContent() {
|
|
7696
|
+
if (this._popUp) {
|
|
7697
|
+
Array.from(this._popUp.children).forEach(c => {
|
|
7698
|
+
this._popUp.removeChild(c);
|
|
7699
|
+
});
|
|
7700
|
+
}
|
|
7701
|
+
}
|
|
7702
|
+
clearPopUpTitle() {
|
|
7703
|
+
this._popUp.ezTitle = "";
|
|
7538
7704
|
}
|
|
7539
7705
|
setPopUpTitle(title) {
|
|
7540
|
-
this._popUp
|
|
7706
|
+
this._popUp.ezTitle = title;
|
|
7541
7707
|
}
|
|
7542
7708
|
componentWillLoad() {
|
|
7543
7709
|
this._errorHandler = new SnkErrorHandler(this);
|
|
@@ -7549,6 +7715,7 @@ const SnkApplication = class {
|
|
|
7549
7715
|
core.ErrorTracking.init();
|
|
7550
7716
|
}
|
|
7551
7717
|
connectedCallback() {
|
|
7718
|
+
core.ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
|
|
7552
7719
|
DataFetcher.addRequestListener(this._requestListener);
|
|
7553
7720
|
}
|
|
7554
7721
|
disconnectedCallback() {
|
|
@@ -7587,6 +7754,12 @@ class RequestListenerLoadingBar {
|
|
|
7587
7754
|
}
|
|
7588
7755
|
;
|
|
7589
7756
|
}
|
|
7757
|
+
class PendingPromise {
|
|
7758
|
+
constructor(resolve, reject) {
|
|
7759
|
+
this.resolve = resolve;
|
|
7760
|
+
this.reject = reject;
|
|
7761
|
+
}
|
|
7762
|
+
}
|
|
7590
7763
|
SnkApplication.style = snkApplicationCss;
|
|
7591
7764
|
|
|
7592
7765
|
exports.snk_application = SnkApplication;
|