@adaptabletools/adaptable 16.0.3-canary.3 → 16.0.3

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.
@@ -1,48 +1,56 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Fdc3Service = void 0;
4
+ const Fdc3Context_1 = require("../../PredefinedConfig/Common/Fdc3Context");
5
+ const Fdc3Intent_1 = require("../../PredefinedConfig/Common/Fdc3Intent");
4
6
  class Fdc3Service {
5
7
  constructor(adaptableApi) {
8
+ var _a, _b, _c, _d, _e, _f;
6
9
  this.adaptableApi = adaptableApi;
7
10
  this.contextHandlerSubscriptions = [];
8
11
  this.intentHandlerSubscriptions = [];
9
12
  this.loggedAgentError = false;
10
- this.adaptableApi.eventApi.on('AdaptableReady', () => {
11
- var _a, _b, _c, _d, _e, _f;
12
- const adaptableHandleIntentFn = (_a = this.getFdc3Options().intents) === null || _a === void 0 ? void 0 : _a.handleIntent;
13
- const listenForIntents = (_c = (_b = this.getFdc3Options().intents) === null || _b === void 0 ? void 0 : _b.listensFor) !== null && _c !== void 0 ? _c : [];
14
- if (listenForIntents.length) {
15
- if (!adaptableHandleIntentFn) {
16
- this.adaptableApi.logError(`Following FDC3 Intent Listener(s) have been provided but no 'handleIntent' function has been supplied in the FDC3 Options`, listenForIntents);
17
- }
18
- listenForIntents.forEach((intent) => {
19
- var _a;
20
- (_a = this.getDesktopAgent()) === null || _a === void 0 ? void 0 : _a.addIntentListener(intent, (context, metadata) => {
21
- this.logFdc3Event('IN', `Intent`, JSON.stringify(context));
22
- const fnContext = Object.assign(Object.assign({}, this.adaptableApi.internalApi.buildBaseContext()), { context,
23
- intent,
24
- metadata });
25
- adaptableHandleIntentFn === null || adaptableHandleIntentFn === void 0 ? void 0 : adaptableHandleIntentFn(fnContext);
26
- }).then((listener) => this.intentHandlerSubscriptions.push(listener));
27
- });
13
+ // 1. Subscribe to FDC3 events
14
+ const adaptableHandleIntentFn = (_a = this.getFdc3Options().intents) === null || _a === void 0 ? void 0 : _a.handleIntent;
15
+ const listenForIntents = (_c = (_b = this.getFdc3Options().intents) === null || _b === void 0 ? void 0 : _b.listensFor) !== null && _c !== void 0 ? _c : [];
16
+ if (listenForIntents.length) {
17
+ if (!adaptableHandleIntentFn) {
18
+ this.adaptableApi.logError(`Following FDC3 Intent Listener(s) have been provided but no 'handleIntent' function has been supplied in the FDC3 Options`, listenForIntents);
28
19
  }
29
- const adaptableHandleContextFn = (_d = this.getFdc3Options().contexts) === null || _d === void 0 ? void 0 : _d.handleContext;
30
- const listenForContexts = (_f = (_e = this.getFdc3Options().contexts) === null || _e === void 0 ? void 0 : _e.listensFor) !== null && _f !== void 0 ? _f : [];
31
- if (listenForContexts === null || listenForContexts === void 0 ? void 0 : listenForContexts.length) {
32
- if (!adaptableHandleContextFn) {
33
- this.adaptableApi.logError(`Following FDC3 Context Listener(s) have been provided but no 'handleContext' function has been supplied in the FDC3 Options`, listenForContexts);
34
- }
35
- listenForContexts.forEach((contextType) => {
36
- var _a;
37
- (_a = this.getDesktopAgent()) === null || _a === void 0 ? void 0 : _a.addContextListener(contextType, (context, metadata) => {
38
- this.logFdc3Event('IN', `Context`, JSON.stringify(context));
39
- const fnContext = Object.assign(Object.assign({}, this.adaptableApi.internalApi.buildBaseContext()), { context,
40
- metadata });
41
- adaptableHandleContextFn === null || adaptableHandleContextFn === void 0 ? void 0 : adaptableHandleContextFn(fnContext);
42
- }).then((listener) => this.contextHandlerSubscriptions.push(listener));
43
- });
20
+ listenForIntents.forEach((intent) => {
21
+ var _a;
22
+ this.adaptableApi.logInfo(`Listening for FDC3 Intent: ${intent}`);
23
+ (_a = this.getDesktopAgent()) === null || _a === void 0 ? void 0 : _a.addIntentListener(intent, (context, metadata) => {
24
+ this.logFdc3Event('IN', `Intent`, JSON.stringify(context));
25
+ const fnContext = Object.assign(Object.assign({}, this.adaptableApi.internalApi.buildBaseContext()), { context,
26
+ intent,
27
+ metadata });
28
+ adaptableHandleIntentFn === null || adaptableHandleIntentFn === void 0 ? void 0 : adaptableHandleIntentFn(fnContext);
29
+ }).then((listener) => this.intentHandlerSubscriptions.push(listener));
30
+ });
31
+ }
32
+ const adaptableHandleContextFn = (_d = this.getFdc3Options().contexts) === null || _d === void 0 ? void 0 : _d.handleContext;
33
+ const listenForContexts = (_f = (_e = this.getFdc3Options().contexts) === null || _e === void 0 ? void 0 : _e.listensFor) !== null && _f !== void 0 ? _f : [];
34
+ if (listenForContexts.length) {
35
+ if (!adaptableHandleContextFn) {
36
+ this.adaptableApi.logError(`Following FDC3 Context Listener(s) have been provided but no 'handleContext' function has been supplied in the FDC3 Options`, listenForContexts);
44
37
  }
45
- });
38
+ listenForContexts.forEach((contextType) => {
39
+ var _a;
40
+ this.adaptableApi.logInfo(`Listening for FDC3 Context: ${contextType}`);
41
+ (_a = this.getDesktopAgent()) === null || _a === void 0 ? void 0 : _a.addContextListener(contextType, (context, metadata) => {
42
+ this.logFdc3Event('IN', `Context`, JSON.stringify(context));
43
+ const fnContext = Object.assign(Object.assign({}, this.adaptableApi.internalApi.buildBaseContext()), { context,
44
+ metadata });
45
+ adaptableHandleContextFn === null || adaptableHandleContextFn === void 0 ? void 0 : adaptableHandleContextFn(fnContext);
46
+ }).then((listener) => this.contextHandlerSubscriptions.push(listener));
47
+ });
48
+ }
49
+ // 2. Init UI Controls default configuration
50
+ this.uiControlsDefaultConfiguration = this.buildUiControlsDefaultConfiguration();
51
+ }
52
+ getUiControlsDefaultConfiguration() {
53
+ return this.uiControlsDefaultConfiguration;
46
54
  }
47
55
  getDesktopAgent() {
48
56
  if (globalThis.fdc3 == null && !this.loggedAgentError) {
@@ -115,5 +123,29 @@ class Fdc3Service {
115
123
  getFdc3Options() {
116
124
  return this.adaptableApi.optionsApi.getFdc3Options();
117
125
  }
126
+ buildUiControlsDefaultConfiguration() {
127
+ var _a, _b;
128
+ const adaptableDefaultContextIcons = Object.keys(Fdc3Context_1.ContextConfiguration).reduce((contextsMapping, contextType) => {
129
+ contextsMapping[contextType] = {
130
+ icon: {
131
+ name: Fdc3Context_1.ContextConfiguration[contextType].icon,
132
+ },
133
+ };
134
+ return contextsMapping;
135
+ }, {});
136
+ const adaptableDefaultIntentIcons = Object.keys(Fdc3Intent_1.Fdc3IntentConfiguration).reduce((intentsMapping, intentType) => {
137
+ intentsMapping[intentType] = {
138
+ icon: {
139
+ name: Fdc3Intent_1.Fdc3IntentConfiguration[intentType].icon,
140
+ },
141
+ };
142
+ return intentsMapping;
143
+ }, {});
144
+ // merge adaptable defaults with (optional) user provided configuration
145
+ return {
146
+ contexts: Object.assign(Object.assign({}, adaptableDefaultContextIcons), (_a = this.getFdc3Options().uiControlsDefaultConfiguration) === null || _a === void 0 ? void 0 : _a.contexts),
147
+ intents: Object.assign(Object.assign({}, adaptableDefaultIntentIcons), (_b = this.getFdc3Options().uiControlsDefaultConfiguration) === null || _b === void 0 ? void 0 : _b.intents),
148
+ };
149
+ }
118
150
  }
119
151
  exports.Fdc3Service = Fdc3Service;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const React = tslib_1.__importStar(require("react"));
5
+ const DefaultIcon_1 = tslib_1.__importDefault(require("./DefaultIcon"));
6
+ exports.default = (props) => (React.createElement(DefaultIcon_1.default, Object.assign({}, props, { viewBox: "0 -960 960 960" }),
7
+ React.createElement("path", { d: "M444-144v-80q-51-11-87.5-46T305-357l74-30q8 36 40.5 64.5T487-294q39 0 64-20t25-52q0-30-22.5-50T474-456q-78-28-114-61.5T324-604q0-50 32.5-86t87.5-47v-79h72v79q72 12 96.5 55t25.5 45l-70 29q-8-26-32-43t-53-17q-35 0-58 18t-23 44q0 26 25 44.5t93 41.5q70 23 102 60t32 94q0 57-37 96t-101 49v77h-72Z" })));
@@ -145,6 +145,9 @@ const instrument_1 = tslib_1.__importDefault(require("./instrument"));
145
145
  const analysis_1 = tslib_1.__importDefault(require("./analysis"));
146
146
  const visibility_1 = tslib_1.__importDefault(require("./visibility"));
147
147
  const visibility_off_1 = tslib_1.__importDefault(require("./visibility-off"));
148
+ const mail_1 = tslib_1.__importDefault(require("./mail"));
149
+ const dollar_1 = tslib_1.__importDefault(require("./dollar"));
150
+ const science_1 = tslib_1.__importDefault(require("./science"));
148
151
  const Icon_1 = require("../Icon");
149
152
  const AdaptableLogger_1 = require("../../agGrid/AdaptableLogger");
150
153
  const allIcons = {
@@ -290,6 +293,9 @@ const allIcons = {
290
293
  'case-sentence': case_sentence_1.default,
291
294
  flag: cell_validation_1.default,
292
295
  fdc3: fdc3_1.default,
296
+ mail: mail_1.default,
297
+ dollar: dollar_1.default,
298
+ science: science_1.default,
293
299
  };
294
300
  Object.keys(allIcons).forEach((name) => {
295
301
  const ReactCmp = allIcons[name];
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const React = tslib_1.__importStar(require("react"));
5
+ const DefaultIcon_1 = tslib_1.__importDefault(require("./DefaultIcon"));
6
+ exports.default = (props) => (React.createElement(DefaultIcon_1.default, Object.assign({}, props, { viewBox: "0 -960 960 960" }),
7
+ React.createElement("path", { d: "M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm320-280L160-640v400h640v-400L480-440Zm0-80 320-200H160l320 200ZM160-640v-80 480-400Z" })));
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const React = tslib_1.__importStar(require("react"));
5
5
  const DefaultIcon_1 = tslib_1.__importDefault(require("./DefaultIcon"));
6
- exports.default = (props) => (React.createElement(DefaultIcon_1.default, Object.assign({}, props),
7
- React.createElement("path", { d: "M14,2H6C4.9,2,4,2.9,4,4v16c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V8L14,2z M6,20V4h7v4h5v12H6z M11,19h2v-1h1 c0.55,0,1-0.45,1-1v-3c0-0.55-0.45-1-1-1h-3v-1h4v-2h-2V9h-2v1h-1c-0.55,0-1,0.45-1,1v3c0,0.55,0.45,1,1,1h3v1H9v2h2V19z" })));
6
+ exports.default = (props) => (React.createElement(DefaultIcon_1.default, Object.assign({}, props, { viewBox: "0 -960 960 960" }),
7
+ React.createElement("path", { d: "M444-192h72v-48h12q20.4 0 34.2-13.8Q576-267.6 576-288v-72q0-20.4-13.8-34.2Q548.4-408 528-408h-96v-72h144v-48h-60v-48h-72v48h-12q-20.4 0-34.2 13.8Q384-500.4 384-480v72q0 20.4 13.8 34.2Q411.6-360 432-360h96v72H384v48h60v48ZM263.717-96Q234-96 213-117.15T192-168v-624q0-29.7 21.15-50.85Q234.3-864 264-864h312l192 192v504q0 29.7-21.162 50.85Q725.676-96 695.96-96H263.717ZM528-624v-168H264v624h432v-456H528ZM264-792v189-189 624-624Z" }),
8
+ ' '));
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const React = tslib_1.__importStar(require("react"));
5
+ const DefaultIcon_1 = tslib_1.__importDefault(require("./DefaultIcon"));
6
+ exports.default = (props) => (React.createElement(DefaultIcon_1.default, Object.assign({}, props, { viewBox: "0 -960 960 960" }),
7
+ React.createElement("path", { d: "M216-144q-46 0-66-40.5t8.976-75.714L360-504v-240h-35.789Q309-744 298.5-754.289q-10.5-10.29-10.5-25.5Q288-795 298.35-805.5 308.7-816 324-816h312q15.3 0 25.65 10.289 10.35 10.29 10.35 25.5Q672-765 661.65-754.5 651.3-744 636-744h-36v240l201 244q28 35 8 75.5T744-144H216Zm0-72h528L528-480v-264h-96v264L216-216Zm265-264Z" })));