solid-panes 3.5.27 → 3.5.28-38b5cde0
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/.babelrc +0 -0
- package/.eslintignore +0 -0
- package/.eslintrc +0 -0
- package/.github/workflows/ci.yml +0 -0
- package/.nvmrc +0 -0
- package/Documentation/VisualLanguage.html +0 -0
- package/Documentation/conventions.md +0 -0
- package/LICENSE.md +0 -0
- package/README.md +0 -2
- package/dev/index.html +0 -0
- package/dev/loader.ts +0 -0
- package/dev/pane/index.ts +0 -0
- package/doc/images/panes-for-classes.epgz +0 -0
- package/doc/images/panes-for-classes.svg +0 -0
- package/jest.config.js +0 -0
- package/jest.setup.ts +0 -0
- package/lib/RDFXMLPane.js +15 -9
- package/lib/RDFXMLPane.js.map +1 -1
- package/lib/argument/argumentPane.js +12 -11
- package/lib/argument/argumentPane.js.map +1 -1
- package/lib/attach/attachPane.js +58 -90
- package/lib/attach/attachPane.js.map +1 -1
- package/lib/audio/audioPane.js +19 -37
- package/lib/audio/audioPane.js.map +1 -1
- package/lib/classInstancePane.js +21 -22
- package/lib/classInstancePane.js.map +1 -1
- package/lib/dashboard/basicPreferences.d.ts +0 -0
- package/lib/dashboard/basicPreferences.d.ts.map +0 -0
- package/lib/dashboard/basicPreferences.js +96 -154
- package/lib/dashboard/basicPreferences.js.map +1 -1
- package/lib/dashboard/dashboardPane.d.ts +0 -0
- package/lib/dashboard/dashboardPane.d.ts.map +0 -0
- package/lib/dashboard/dashboardPane.js +2 -18
- package/lib/dashboard/dashboardPane.js.map +1 -1
- package/lib/dashboard/homepage.d.ts +0 -0
- package/lib/dashboard/homepage.d.ts.map +0 -0
- package/lib/dashboard/homepage.js +27 -49
- package/lib/dashboard/homepage.js.map +1 -1
- package/lib/dataContentPane.js +26 -61
- package/lib/dataContentPane.js.map +1 -1
- package/lib/defaultPane.js +23 -23
- package/lib/defaultPane.js.map +1 -1
- package/lib/dokieli/dokieliPane.js +29 -34
- package/lib/dokieli/dokieliPane.js.map +1 -1
- package/lib/dokieli/new.js +6 -1
- package/lib/dokieli/new.js.map +1 -1
- package/lib/form/pane.js +34 -45
- package/lib/form/pane.js.map +1 -1
- package/lib/global.d.js +0 -0
- package/lib/global.d.js.map +0 -0
- package/lib/home/homePane.d.ts +0 -0
- package/lib/home/homePane.d.ts.map +1 -1
- package/lib/home/homePane.js +38 -68
- package/lib/home/homePane.js.map +1 -1
- package/lib/humanReadablePane.js +14 -28
- package/lib/humanReadablePane.js.map +1 -1
- package/lib/imagePane.js +19 -14
- package/lib/imagePane.js.map +1 -1
- package/lib/index.d.ts +0 -0
- package/lib/index.d.ts.map +0 -0
- package/lib/index.js +6 -20
- package/lib/index.js.map +1 -1
- package/lib/internal/internalPane.d.ts +0 -0
- package/lib/internal/internalPane.d.ts.map +0 -0
- package/lib/internal/internalPane.js +10 -41
- package/lib/internal/internalPane.js.map +1 -1
- package/lib/mainPage/footer.d.ts +0 -0
- package/lib/mainPage/footer.d.ts.map +0 -0
- package/lib/mainPage/footer.js +0 -4
- package/lib/mainPage/footer.js.map +1 -1
- package/lib/mainPage/header.d.ts +0 -0
- package/lib/mainPage/header.d.ts.map +0 -0
- package/lib/mainPage/header.js +66 -100
- package/lib/mainPage/header.js.map +1 -1
- package/lib/mainPage/index.d.ts +0 -0
- package/lib/mainPage/index.d.ts.map +0 -0
- package/lib/mainPage/index.js +17 -30
- package/lib/mainPage/index.js.map +1 -1
- package/lib/microblogPane/microblogPane.js +182 -321
- package/lib/microblogPane/microblogPane.js.map +1 -1
- package/lib/n3Pane.js +12 -8
- package/lib/n3Pane.js.map +1 -1
- package/lib/outline/context.d.ts +0 -0
- package/lib/outline/context.d.ts.map +0 -0
- package/lib/outline/context.js +0 -2
- package/lib/outline/context.js.map +1 -1
- package/lib/outline/licenseOptions.js +21 -35
- package/lib/outline/licenseOptions.js.map +1 -1
- package/lib/outline/manager.js +740 -1176
- package/lib/outline/manager.js.map +1 -1
- package/lib/outline/manager.test.js +16 -25
- package/lib/outline/manager.test.js.map +1 -1
- package/lib/outline/outlineIcons.js +39 -26
- package/lib/outline/outlineIcons.js.map +1 -1
- package/lib/outline/propertyViews.d.ts +3 -2
- package/lib/outline/propertyViews.d.ts.map +1 -1
- package/lib/outline/propertyViews.js +7 -15
- package/lib/outline/propertyViews.js.map +1 -1
- package/lib/outline/propertyViews.test.js +7 -7
- package/lib/outline/propertyViews.test.js.map +1 -1
- package/lib/outline/queryByExample.js +28 -80
- package/lib/outline/queryByExample.js.map +1 -1
- package/lib/outline/userInput.js +221 -459
- package/lib/outline/userInput.js.map +1 -1
- package/lib/outline/viewAsImage.d.ts +0 -0
- package/lib/outline/viewAsImage.d.ts.map +0 -0
- package/lib/outline/viewAsImage.js +0 -6
- package/lib/outline/viewAsImage.js.map +1 -1
- package/lib/outline/viewAsMbox.d.ts +0 -0
- package/lib/outline/viewAsMbox.d.ts.map +0 -0
- package/lib/outline/viewAsMbox.js +3 -4
- package/lib/outline/viewAsMbox.js.map +1 -1
- package/lib/pad/padPane.d.ts +0 -0
- package/lib/pad/padPane.d.ts.map +0 -0
- package/lib/pad/padPane.js +45 -93
- package/lib/pad/padPane.js.map +1 -1
- package/lib/playlist/playlistPane.js +11 -21
- package/lib/playlist/playlistPane.js.map +1 -1
- package/lib/profile/editProfile.view.d.ts +0 -0
- package/lib/profile/editProfile.view.d.ts.map +1 -1
- package/lib/profile/editProfile.view.js +22 -23
- package/lib/profile/editProfile.view.js.map +1 -1
- package/lib/profile/profile.dom.d.ts +0 -0
- package/lib/profile/profile.dom.d.ts.map +0 -0
- package/lib/profile/profile.dom.js +0 -3
- package/lib/profile/profile.dom.js.map +1 -1
- package/lib/registerPanes.js +99 -54
- package/lib/registerPanes.js.map +1 -1
- package/lib/schedule/formsForSchedule.js +6 -1
- package/lib/schedule/formsForSchedule.js.map +1 -1
- package/lib/schedule/schedulePane.js +71 -126
- package/lib/schedule/schedulePane.js.map +1 -1
- package/lib/sharing/sharingPane.d.ts +0 -0
- package/lib/sharing/sharingPane.d.ts.map +0 -0
- package/lib/sharing/sharingPane.js +2 -10
- package/lib/sharing/sharingPane.js.map +1 -1
- package/lib/slideshow/slideshowPane.js +21 -21
- package/lib/slideshow/slideshowPane.js.map +1 -1
- package/lib/socialPane.js +58 -135
- package/lib/socialPane.js.map +1 -1
- package/lib/tabbed/tabbedPane.d.ts +0 -0
- package/lib/tabbed/tabbedPane.d.ts.map +0 -0
- package/lib/tabbed/tabbedPane.js +32 -48
- package/lib/tabbed/tabbedPane.js.map +1 -1
- package/lib/tableViewPane.js +15 -9
- package/lib/tableViewPane.js.map +1 -1
- package/lib/test-import-export/common.js +8 -3
- package/lib/test-import-export/common.js.map +1 -1
- package/lib/test-import-export/edit-importer.js +10 -14
- package/lib/test-import-export/edit-importer.js.map +1 -1
- package/lib/test-import-export/testImportExport.js +0 -0
- package/lib/test-import-export/testImportExport.js.map +0 -0
- package/lib/transaction/pane.js +38 -91
- package/lib/transaction/pane.js.map +1 -1
- package/lib/transaction/period.js +27 -71
- package/lib/transaction/period.js.map +1 -1
- package/lib/trip/tripPane.js +38 -35
- package/lib/trip/tripPane.js.map +1 -1
- package/lib/trustedApplications/trustedApplications.dom.d.ts +0 -0
- package/lib/trustedApplications/trustedApplications.dom.d.ts.map +0 -0
- package/lib/trustedApplications/trustedApplications.dom.js +12 -35
- package/lib/trustedApplications/trustedApplications.dom.js.map +1 -1
- package/lib/trustedApplications/trustedApplications.test.js +6 -8
- package/lib/trustedApplications/trustedApplications.test.js.map +1 -1
- package/lib/trustedApplications/trustedApplications.utils.d.ts +0 -0
- package/lib/trustedApplications/trustedApplications.utils.d.ts.map +0 -0
- package/lib/trustedApplications/trustedApplications.utils.js +1 -11
- package/lib/trustedApplications/trustedApplications.utils.js.map +1 -1
- package/lib/trustedApplications/trustedApplications.view.d.ts +0 -0
- package/lib/trustedApplications/trustedApplications.view.d.ts.map +0 -0
- package/lib/trustedApplications/trustedApplications.view.js +38 -61
- package/lib/trustedApplications/trustedApplications.view.js.map +1 -1
- package/lib/types.d.ts +0 -0
- package/lib/types.d.ts.map +0 -0
- package/lib/types.js +0 -0
- package/lib/types.js.map +0 -0
- package/lib/ui/pane.js +30 -29
- package/lib/ui/pane.js.map +1 -1
- package/lib/versionInfo.d.ts +0 -0
- package/lib/versionInfo.d.ts.map +0 -0
- package/lib/versionInfo.js +14 -14
- package/lib/versionInfo.js.map +1 -1
- package/lib/video/videoPane.js +11 -7
- package/lib/video/videoPane.js.map +1 -1
- package/package.json +26 -26
- package/src/RDFXMLPane.js +2 -2
- package/src/argument/argumentPane.js +1 -1
- package/src/argument/argument_icon_v04.jpg +0 -0
- package/src/argument/icon_argument.png +0 -0
- package/src/argument/transparentyingyang.png +0 -0
- package/src/attach/attachPane.js +3 -3
- package/src/attach/tbl-paperclip-128.png +0 -0
- package/src/attach/tbl-paperclip-22.png +0 -0
- package/src/attach/tbl-paperclip-22a.png +0 -0
- package/src/audio/audioPane.js +3 -3
- package/src/chatPreferencesForm.ttl +0 -0
- package/src/classInstancePane.js +3 -3
- package/src/dashboard/basicPreferences.ts +0 -0
- package/src/dashboard/dashboardPane.ts +0 -0
- package/src/dashboard/homepage.ts +0 -0
- package/src/dashboard/languages/codes.html +0 -0
- package/src/dashboard/languages/codes.xml +0 -0
- package/src/dashboard/languages/codes2.txt +0 -0
- package/src/dashboard/languages/foo +0 -0
- package/src/dashboard/languages/foo.ttl +0 -0
- package/src/dashboard/languages/get-language-names.sh +0 -0
- package/src/dashboard/ontologyData.ttl +0 -0
- package/src/dashboard/preferencesFormText.ttl +0 -0
- package/src/dataContentPane.js +3 -4
- package/src/defaultPane.js +3 -3
- package/src/dokieli/Makefile +0 -0
- package/src/dokieli/dokieliPane.js +5 -5
- package/src/dokieli/new.html +0 -0
- package/src/dokieli/new.js +1 -1
- package/src/form/form-22.png +0 -0
- package/src/form/form-b-22.png +0 -0
- package/src/form/form.graffle +0 -0
- package/src/form/form.png +0 -0
- package/src/form/pane.js +2 -2
- package/src/form/psuedocode-notes.txt +0 -0
- package/src/global.d.ts +0 -0
- package/src/home/homePane.ts +1 -14
- package/src/humanReadablePane.js +0 -0
- package/src/imagePane.js +2 -2
- package/src/index.ts +1 -1
- package/src/internal/internalPane.ts +0 -0
- package/src/mainPage/footer.ts +0 -0
- package/src/mainPage/header.ts +0 -0
- package/src/mainPage/index.ts +0 -0
- package/src/meeting/Makefile +0 -0
- package/src/meeting/test/meeting1/Actions/actions.ttl +0 -0
- package/src/meeting/test/meeting1/Actions/config.ttl +0 -0
- package/src/meeting/test/meeting1/Actions/state.ttl +0 -0
- package/src/meeting/test/meeting1/Schedule/details.ttl +0 -0
- package/src/meeting/test/meeting1/Schedule/details.ttl.acl +0 -0
- package/src/meeting/test/meeting1/Schedule/forms.ttl +0 -0
- package/src/meeting/test/meeting1/Schedule/forms.ttl.acl +0 -0
- package/src/meeting/test/meeting1/Schedule/index.html +0 -0
- package/src/meeting/test/meeting1/Schedule/index.html.acl +0 -0
- package/src/meeting/test/meeting1/Schedule/results.ttl +0 -0
- package/src/meeting/test/meeting1/Schedule/results.ttl.acl +0 -0
- package/src/meeting/test/meeting1/SharedNotes/pad.ttl +0 -0
- package/src/meeting/test/meeting1/chat/chat.ttl +0 -0
- package/src/meeting/test/meeting1/details.ttl +0 -0
- package/src/meeting/test/meeting1/pad/pad.ttl +0 -0
- package/src/microblogPane/mbStyle.css +0 -0
- package/src/microblogPane/microblogPane.js +1 -1
- package/src/n3Pane.js +2 -2
- package/src/outline/context.ts +0 -0
- package/src/outline/licenseOptions.js +9 -8
- package/src/outline/manager.js +18 -20
- package/src/outline/manager.test.ts +6 -0
- package/src/outline/outlineIcons.js +4 -2
- package/src/outline/propertyViews.test.ts +7 -1
- package/src/outline/propertyViews.ts +3 -3
- package/src/outline/queryByExample.js +3 -9
- package/src/outline/userInput.js +1 -1
- package/src/outline/viewAsImage.ts +0 -0
- package/src/outline/viewAsMbox.ts +0 -0
- package/src/pad/images/ColourOff.ai +0 -0
- package/src/pad/images/ColourOff.png +0 -0
- package/src/pad/images/ColourOn.ai +0 -0
- package/src/pad/images/ColourOn.png +0 -0
- package/src/pad/padPane.ts +0 -0
- package/src/playlist/playlistPane.js +3 -3
- package/src/profile/editProfile.view.ts +20 -0
- package/src/profile/profile.dom.ts +0 -0
- package/src/profile/profileFormText.ttl +0 -0
- package/src/registerPanes.js +92 -52
- package/src/schedule/Makefile +0 -0
- package/src/schedule/formsForSchedule.js +1 -1
- package/src/schedule/formsForSchedule.ttl +0 -0
- package/src/schedule/schedulePane.js +6 -2
- package/src/sharing/sharingPane.ts +0 -0
- package/src/slideshow/slideshowPane.js +3 -6
- package/src/socialPane.js +4 -5
- package/src/style/tabbedtab.css +0 -0
- package/src/tabbed/tabbedPane.ts +0 -0
- package/src/tableViewPane.js +3 -3
- package/src/test-import-export/common.js +1 -1
- package/src/test-import-export/edit-importer.js +5 -10
- package/src/test-import-export/testImportExport.js +0 -0
- package/src/transaction/068010-3d-transparent-glass-icon-alphanumeric-dollar-sign.png +0 -0
- package/src/transaction/075988-3d-transparent-glass-icon-business-currency-british-pound-sc35.png +0 -0
- package/src/transaction/22-pixel-068010-3d-transparent-glass-icon-alphanumeric-dollar-sign.png +0 -0
- package/src/transaction/pane.js +3 -3
- package/src/transaction/period.js +2 -2
- package/src/transaction/thumbs_075987-3d-transparent-glass-icon-business-creditcard2.png +0 -0
- package/src/transaction/thumbs_075989-3d-transparent-glass-icon-business-currency-cent-sc35.png +0 -0
- package/src/trip/tripPane.js +3 -3
- package/src/trustedApplications/__snapshots__/trustedApplications.test.ts.snap +0 -0
- package/src/trustedApplications/trustedApplications.dom.ts +0 -0
- package/src/trustedApplications/trustedApplications.test.ts +4 -0
- package/src/trustedApplications/trustedApplications.utils.ts +0 -0
- package/src/trustedApplications/trustedApplications.view.ts +0 -0
- package/src/types.ts +0 -0
- package/src/ui/22-builder.png +0 -0
- package/src/ui/builder.graffle +0 -0
- package/src/ui/builder.png +0 -0
- package/src/ui/builder2.png +0 -0
- package/src/ui/pane.js +3 -3
- package/src/versionInfo.ts +14 -14
- package/src/video/videoPane.js +3 -3
- package/timestamp.sh +0 -0
- package/travis/bumpversion.js +0 -0
- package/tsconfig.json +0 -0
- package/typings/raw-loader.d.ts +0 -0
- package/typings/solid-namespace/index.d.ts +0 -0
- package/webpack.config.js +0 -0
package/lib/transaction/pane.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
9
|
+
var $rdf = _interopRequireWildcard(require("rdflib"));
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
3
12
|
/* Financial Transaction Pane
|
|
4
13
|
**
|
|
5
14
|
** This outline pane allows a user to interact with a transaction
|
|
6
15
|
** downloaded from a bank statement, annotting it with classes and comments,
|
|
7
16
|
** trips, etc
|
|
8
17
|
*/
|
|
9
|
-
var UI = require('solid-ui');
|
|
10
|
-
|
|
11
|
-
var $rdf = require('rdflib');
|
|
12
18
|
|
|
13
19
|
var ns = UI.ns;
|
|
14
|
-
|
|
20
|
+
var _default = {
|
|
15
21
|
// icon: (module.__dirname || __dirname) + '22-pixel-068010-3d-transparent-glass-icon-alphanumeric-dollar-sign.png',
|
|
16
22
|
icon: UI.icons.iconBase + 'noun_106746.svg',
|
|
17
23
|
name: 'transaction',
|
|
@@ -22,11 +28,13 @@ module.exports = {
|
|
|
22
28
|
var t = kb.findTypeURIs(subject);
|
|
23
29
|
if (t['http://www.w3.org/2000/10/swap/pim/qif#Transaction']) return '$$';
|
|
24
30
|
if (kb.any(subject, UI.ns.qu('amount'))) return '$$$'; // In case schema not picked up
|
|
31
|
+
|
|
25
32
|
// if (t['http://www.w3.org/2000/10/swap/pim/qif#Period']) return "period $"
|
|
26
33
|
|
|
27
34
|
if (t['http://www.w3.org/ns/pim/trip#Trip']) return 'Trip $';
|
|
28
35
|
return null; // No under other circumstances (while testing at least!)
|
|
29
36
|
},
|
|
37
|
+
|
|
30
38
|
render: function render(subject, context) {
|
|
31
39
|
var dom = context.dom;
|
|
32
40
|
var kb = context.session.store;
|
|
@@ -35,7 +43,6 @@ module.exports = {
|
|
|
35
43
|
var TRIP = $rdf.Namespace('http://www.w3.org/ns/pim/trip#');
|
|
36
44
|
var div = dom.createElement('div');
|
|
37
45
|
div.setAttribute('class', 'transactionPane');
|
|
38
|
-
|
|
39
46
|
var mention = function mention(message, style) {
|
|
40
47
|
if (style === undefined) style = 'color: grey';
|
|
41
48
|
var pre = dom.createElement('pre');
|
|
@@ -43,10 +50,10 @@ module.exports = {
|
|
|
43
50
|
div.appendChild(pre);
|
|
44
51
|
pre.appendChild(dom.createTextNode(message));
|
|
45
52
|
};
|
|
46
|
-
|
|
47
53
|
var complain = function complain(message) {
|
|
48
54
|
return mention(message, 'color: #100; background-color: #fee');
|
|
49
55
|
};
|
|
56
|
+
|
|
50
57
|
/*
|
|
51
58
|
var thisPane = this
|
|
52
59
|
var rerender = function (div) {
|
|
@@ -57,89 +64,72 @@ module.exports = {
|
|
|
57
64
|
*/
|
|
58
65
|
// //////////////////////////////////////////////////////////////////////////////
|
|
59
66
|
|
|
60
|
-
|
|
61
67
|
var plist = kb.statementsMatching(subject);
|
|
62
68
|
var qlist = kb.statementsMatching(undefined, undefined, subject);
|
|
63
|
-
var t = kb.findTypeURIs(subject);
|
|
69
|
+
var t = kb.findTypeURIs(subject);
|
|
64
70
|
|
|
71
|
+
// var me = authn.currentUser()
|
|
65
72
|
var predicateURIsDone = {};
|
|
66
|
-
|
|
67
73
|
var donePredicate = function donePredicate(pred) {
|
|
68
74
|
predicateURIsDone[pred.uri] = true;
|
|
69
75
|
};
|
|
70
|
-
|
|
71
76
|
var setPaneStyle = function setPaneStyle(account) {
|
|
72
77
|
var mystyle = 'padding: 0.5em 1.5em 1em 1.5em; ';
|
|
73
|
-
|
|
74
78
|
if (account) {
|
|
75
79
|
var backgroundColor = kb.any(account, UI.ns.ui('backgroundColor'));
|
|
76
|
-
|
|
77
80
|
if (backgroundColor) {
|
|
78
81
|
mystyle += 'background-color: ' + backgroundColor.value + '; ';
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
|
-
|
|
82
84
|
div.setAttribute('style', mystyle);
|
|
83
|
-
};
|
|
85
|
+
};
|
|
86
|
+
// setPaneStyle()
|
|
87
|
+
|
|
84
88
|
// Functions for displaying lists of transactions
|
|
85
89
|
// Click on the transaction line to expand it into a pane
|
|
86
90
|
// Shift-click to expand without collapsing others
|
|
87
91
|
|
|
88
|
-
|
|
89
92
|
var d2 = function d2(n) {
|
|
90
93
|
if (n === undefined) return '';
|
|
91
94
|
var s = '' + n;
|
|
92
|
-
|
|
93
95
|
if (s.indexOf('.') >= 0) {
|
|
94
96
|
return s.split('.')[0] + '.' + (s.split('.')[1] + '00').slice(0, 2);
|
|
95
97
|
}
|
|
96
|
-
|
|
97
98
|
return s + '.00';
|
|
98
99
|
};
|
|
99
|
-
|
|
100
100
|
var numericCell = function numericCell(amount, suppressZero) {
|
|
101
101
|
var td = dom.createElement('td');
|
|
102
|
-
|
|
103
102
|
if (!(0.0 + amount === 0.0 && suppressZero)) {
|
|
104
103
|
td.textContent = d2(amount);
|
|
105
104
|
}
|
|
106
|
-
|
|
107
105
|
td.setAttribute('style', 'width: 6em; text-align: right; ');
|
|
108
106
|
return td;
|
|
109
107
|
};
|
|
110
|
-
|
|
111
108
|
var headerCell = function headerCell(str) {
|
|
112
109
|
var td = dom.createElement('th');
|
|
113
110
|
td.textContent = str;
|
|
114
111
|
td.setAttribute('style', 'text-align: right; ');
|
|
115
112
|
return td;
|
|
116
113
|
};
|
|
117
|
-
|
|
118
114
|
var oderByDate = function oderByDate(x, y) {
|
|
119
115
|
var dx = kb.any(x, ns.qu('date'));
|
|
120
116
|
var dy = kb.any(y, ns.qu('date'));
|
|
121
|
-
|
|
122
117
|
if (dx !== undefined && dy !== undefined) {
|
|
123
118
|
if (dx.value < dy.value) return -1;
|
|
124
119
|
if (dx.value > dy.value) return 1;
|
|
125
120
|
}
|
|
126
|
-
|
|
127
121
|
if (x.uri < y.uri) return -1; // Arbitrary but repeatable
|
|
128
|
-
|
|
129
122
|
if (x.uri > y.uri) return 1;
|
|
130
123
|
return 0;
|
|
131
124
|
};
|
|
132
|
-
|
|
133
125
|
var insertedPane = function insertedPane(context, subject, paneName) {
|
|
134
126
|
var p = context.session.paneRegistry.byName(paneName);
|
|
135
127
|
var d = p.render(subject, context);
|
|
136
128
|
d.setAttribute('style', 'border: 0.1em solid green;');
|
|
137
129
|
return d;
|
|
138
130
|
};
|
|
139
|
-
|
|
140
131
|
var expandAfterRow = function expandAfterRow(dom, row, subject, paneName, solo) {
|
|
141
132
|
var siblings = row.parentNode.children;
|
|
142
|
-
|
|
143
133
|
if (solo) {
|
|
144
134
|
for (var j = siblings.length - 1; j >= 0; j--) {
|
|
145
135
|
if (siblings[j].expanded) {
|
|
@@ -148,23 +138,19 @@ module.exports = {
|
|
|
148
138
|
}
|
|
149
139
|
}
|
|
150
140
|
}
|
|
151
|
-
|
|
152
141
|
var tr = dom.createElement('tr');
|
|
153
142
|
var td = tr.appendChild(dom.createElement('td'));
|
|
154
143
|
td.setAttribute('style', 'width: 98%; padding: 1em; border: 0.1em solid grey;');
|
|
155
144
|
var cols = row.children.length;
|
|
156
|
-
|
|
157
145
|
if (row.nextSibling) {
|
|
158
146
|
row.parentNode.insertBefore(tr, row.nextSibling);
|
|
159
147
|
} else {
|
|
160
148
|
row.parentNode.appendChild(tr);
|
|
161
149
|
}
|
|
162
|
-
|
|
163
150
|
row.expanded = tr;
|
|
164
151
|
td.setAttribute('colspan', '' + cols);
|
|
165
152
|
td.appendChild(insertedPane(context, subject, paneName));
|
|
166
153
|
};
|
|
167
|
-
|
|
168
154
|
var expandAfterRowOrCollapse = function expandAfterRowOrCollapse(dom, row, subject, paneName, solo) {
|
|
169
155
|
if (row.expanded) {
|
|
170
156
|
row.parentNode.removeChild(row.expanded);
|
|
@@ -173,29 +159,22 @@ module.exports = {
|
|
|
173
159
|
expandAfterRow(dom, row, subject, paneName, solo);
|
|
174
160
|
}
|
|
175
161
|
};
|
|
176
|
-
|
|
177
162
|
var transactionTable = function transactionTable(dom, list, filter) {
|
|
178
163
|
var table = dom.createElement('table');
|
|
179
164
|
table.setAttribute('style', 'padding-left: 0.5em; padding-right: 0.5em; font-size: 9pt; width: 85%;');
|
|
180
|
-
|
|
181
165
|
var transactionRow = function transactionRow(dom, x) {
|
|
182
166
|
var tr = dom.createElement('tr');
|
|
183
|
-
|
|
184
167
|
var setTRStyle = function setTRStyle(tr, account) {
|
|
185
168
|
// var mystyle = "padding: 0.5em 1.5em 1em 1.5em; "
|
|
186
169
|
var mystyle = "'padding-left: 0.5em; padding-right: 0.5em; padding-top: 0.1em;";
|
|
187
|
-
|
|
188
170
|
if (account) {
|
|
189
171
|
var backgroundColor = kb.any(account, UI.ns.ui('backgroundColor'));
|
|
190
|
-
|
|
191
172
|
if (backgroundColor) {
|
|
192
173
|
mystyle += 'background-color: ' + backgroundColor.value + '; ';
|
|
193
174
|
}
|
|
194
175
|
}
|
|
195
|
-
|
|
196
176
|
tr.setAttribute('style', mystyle);
|
|
197
177
|
};
|
|
198
|
-
|
|
199
178
|
var account = kb.any(x, ns.qu('toAccount'));
|
|
200
179
|
setTRStyle(tr, account);
|
|
201
180
|
var c0 = tr.appendChild(dom.createElement('td'));
|
|
@@ -213,55 +192,45 @@ module.exports = {
|
|
|
213
192
|
var amount = kb.any(x, ns.qu('in_USD'));
|
|
214
193
|
c3.textContent = amount ? d2(amount.value) : '???';
|
|
215
194
|
c3.setAttribute('style', 'width: 6em; text-align: right; '); // @@ decimal alignment?
|
|
216
|
-
|
|
217
195
|
tr.addEventListener('click', function (e) {
|
|
218
196
|
// solo unless shift key
|
|
219
197
|
expandAfterRowOrCollapse(dom, tr, x, 'transaction', !e.shiftKey);
|
|
220
198
|
}, false);
|
|
221
199
|
return tr;
|
|
222
200
|
};
|
|
223
|
-
|
|
224
201
|
var list2 = filter ? list.filter(filter) : list.slice(); // don't sort a paramater passed in place
|
|
225
|
-
|
|
226
202
|
list2.sort(oderByDate);
|
|
227
|
-
|
|
228
203
|
for (var i = 0; i < list2.length; i++) {
|
|
229
204
|
table.appendChild(transactionRow(dom, list2[i]));
|
|
230
205
|
}
|
|
231
|
-
|
|
232
206
|
return table;
|
|
233
|
-
};
|
|
234
|
-
// This works only if enough metadata about the properties can drive the RDFS
|
|
235
|
-
// (or actual type statements whichtypically are NOT there on)
|
|
207
|
+
};
|
|
236
208
|
|
|
209
|
+
// Render a single transaction
|
|
237
210
|
|
|
211
|
+
// This works only if enough metadata about the properties can drive the RDFS
|
|
212
|
+
// (or actual type statements whichtypically are NOT there on)
|
|
238
213
|
if (t['http://www.w3.org/2000/10/swap/pim/qif#Transaction'] || kb.any(subject, ns.qu('toAccount'))) {
|
|
239
214
|
// var trip = kb.any(subject, WF('trip'))
|
|
240
215
|
donePredicate(ns.rdf('type'));
|
|
241
216
|
var account = kb.any(subject, UI.ns.qu('toAccount'));
|
|
242
217
|
setPaneStyle(account);
|
|
243
|
-
|
|
244
218
|
if (!account) {
|
|
245
219
|
complain('(Error: There is no bank account known for this transaction <' + subject.uri + '>,\n -- every transaction needs one.)');
|
|
246
220
|
}
|
|
247
|
-
|
|
248
221
|
var store = null;
|
|
249
222
|
var statement = kb.any(subject, UI.ns.qu('accordingTo'));
|
|
250
|
-
|
|
251
223
|
if (statement === undefined) {
|
|
252
224
|
complain('(Error: There is no back link to the original data source foir this transaction <' + subject.uri + ">,\nso I can't tell how to annotate it.)");
|
|
253
225
|
} else {
|
|
254
226
|
store = statement !== undefined ? kb.any(statement, UI.ns.qu('annotationStore')) : null;
|
|
255
|
-
|
|
256
227
|
if (store === undefined) {
|
|
257
228
|
complain('(There is no annotation document for this statement\n<' + statement.uri + '>,\nso you cannot classify this transaction.)');
|
|
258
229
|
}
|
|
259
230
|
}
|
|
260
|
-
|
|
261
231
|
var nav = dom.createElement('div');
|
|
262
232
|
nav.setAttribute('style', 'float:right');
|
|
263
233
|
div.appendChild(nav);
|
|
264
|
-
|
|
265
234
|
var navLink = function navLink(pred, label) {
|
|
266
235
|
donePredicate(pred);
|
|
267
236
|
var obj = kb.any(subject, pred);
|
|
@@ -272,11 +241,11 @@ module.exports = {
|
|
|
272
241
|
nav.appendChild(a).textContent = label || UI.utils.label(obj);
|
|
273
242
|
nav.appendChild(dom.createElement('br'));
|
|
274
243
|
};
|
|
275
|
-
|
|
276
244
|
navLink(UI.ns.qu('toAccount'));
|
|
277
245
|
navLink(UI.ns.qu('accordingTo'), 'Statement');
|
|
278
|
-
navLink(TRIP('trip'));
|
|
246
|
+
navLink(TRIP('trip'));
|
|
279
247
|
|
|
248
|
+
// Basic data:
|
|
280
249
|
var table = dom.createElement('table');
|
|
281
250
|
div.appendChild(table);
|
|
282
251
|
var preds = ['date', 'payee', 'amount', 'in_USD', 'currency'].map(Q);
|
|
@@ -287,24 +256,23 @@ module.exports = {
|
|
|
287
256
|
return '<tr><td style="text-align: right; padding-right: 0.6em">' + UI.utils.labelForXML(p) + '</td><td style="font-weight: bold;">' + s + '</td></tr>';
|
|
288
257
|
}).join('\n');
|
|
289
258
|
table.innerHTML = inner;
|
|
290
|
-
|
|
291
259
|
var complainIfBad = function complainIfBad(ok, body) {
|
|
292
|
-
if (ok) {
|
|
260
|
+
if (ok) {
|
|
261
|
+
// setModifiedDate(store, kb, store)
|
|
293
262
|
// rerender(div) // deletes the new trip form
|
|
294
263
|
} else complain('Sorry, failed to save your change:\n' + body);
|
|
295
|
-
};
|
|
296
|
-
// Classify:
|
|
264
|
+
};
|
|
297
265
|
|
|
266
|
+
// What trips do we know about?
|
|
298
267
|
|
|
268
|
+
// Classify:
|
|
299
269
|
if (store) {
|
|
300
270
|
kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {
|
|
301
271
|
if (!ok) complain('Cannot load store ' + store + ' ' + body);
|
|
302
272
|
var calendarYear = kb.any(store, ns.qu('calendarYear'));
|
|
303
|
-
|
|
304
273
|
var renderCatgorySelectors = function renderCatgorySelectors() {
|
|
305
274
|
div.insertBefore(UI.widgets.makeSelectForNestedCategory(dom, kb, subject, UI.ns.qu('Classified'), store, complainIfBad), table.nextSibling);
|
|
306
275
|
};
|
|
307
|
-
|
|
308
276
|
if (kb.any(undefined, ns.rdfs('subClassOf'), ns.qu.Classified)) {
|
|
309
277
|
renderCatgorySelectors();
|
|
310
278
|
} else if (calendarYear) {
|
|
@@ -320,12 +288,10 @@ module.exports = {
|
|
|
320
288
|
} else {
|
|
321
289
|
console.log("Can't get categories, because no calendarYear");
|
|
322
290
|
}
|
|
323
|
-
|
|
324
291
|
div.appendChild(UI.widgets.makeDescription(dom, kb, subject, UI.ns.rdfs('comment'), store, complainIfBad));
|
|
325
292
|
var trips = kb.statementsMatching(undefined, TRIP('trip'), undefined, store).map(function (st) {
|
|
326
293
|
return st.object;
|
|
327
294
|
}); // @@ Use rdfs
|
|
328
|
-
|
|
329
295
|
var trips2 = kb.each(undefined, UI.ns.rdf('type'), TRIP('Trip'));
|
|
330
296
|
trips = trips.concat(trips2).sort(); // @@ Unique
|
|
331
297
|
|
|
@@ -341,7 +307,6 @@ module.exports = {
|
|
|
341
307
|
return pair[1];
|
|
342
308
|
});
|
|
343
309
|
};
|
|
344
|
-
|
|
345
310
|
trips = sortedBy(kb, trips, UI.ns.cal('dtstart'), true); // Reverse chron
|
|
346
311
|
|
|
347
312
|
if (trips.length > 1) {
|
|
@@ -357,8 +322,9 @@ module.exports = {
|
|
|
357
322
|
}
|
|
358
323
|
}, store, complainIfBad));
|
|
359
324
|
}
|
|
325
|
+
div.appendChild(dom.createElement('br'));
|
|
360
326
|
|
|
361
|
-
|
|
327
|
+
// Add in simple comments about the transaction
|
|
362
328
|
|
|
363
329
|
var outliner = context.getOutliner(dom);
|
|
364
330
|
donePredicate(ns.rdfs('comment')); // Done above
|
|
@@ -366,8 +332,8 @@ module.exports = {
|
|
|
366
332
|
UI.widgets.attachmentList(dom, subject, div);
|
|
367
333
|
donePredicate(ns.wf('attachment'));
|
|
368
334
|
div.appendChild(dom.createElement('tr')).setAttribute('style', 'height: 1em'); // spacer
|
|
369
|
-
// Remaining properties
|
|
370
335
|
|
|
336
|
+
// Remaining properties
|
|
371
337
|
outliner.appendPropertyTRs(div, plist, false, function (pred, _inverse) {
|
|
372
338
|
return !(pred.uri in predicateURIsDone);
|
|
373
339
|
});
|
|
@@ -375,12 +341,13 @@ module.exports = {
|
|
|
375
341
|
return !(pred.uri in predicateURIsDone);
|
|
376
342
|
});
|
|
377
343
|
}); // fetch
|
|
378
|
-
}
|
|
344
|
+
}
|
|
345
|
+
// end of render tranasaction instance
|
|
346
|
+
|
|
379
347
|
// ////////////////////////////////////////////////////////////////////
|
|
380
348
|
//
|
|
381
349
|
// Render the transactions in a Trip
|
|
382
350
|
//
|
|
383
|
-
|
|
384
351
|
} else if (t['http://www.w3.org/ns/pim/trip#Trip']) {
|
|
385
352
|
/*
|
|
386
353
|
var query = new $rdf.Query(UI.utils.label(subject))
|
|
@@ -415,25 +382,19 @@ module.exports = {
|
|
|
415
382
|
var year = date ? ('' + date.value).slice(0, 4) : '????';
|
|
416
383
|
var ty = kb.the(t, ns.rdf('type')); // @@ find most specific type
|
|
417
384
|
// complain(" -- one trans: "+t.uri + ' -> '+kb.any(t, UI.ns.qu('in_USD')))
|
|
418
|
-
|
|
419
385
|
if (!ty) ty = UI.ns.qu('ErrorNoType');
|
|
420
|
-
|
|
421
386
|
if (ty && ty.uri) {
|
|
422
387
|
var tyuri = ty.uri;
|
|
423
388
|
if (!yearTotal[year]) yearTotal[year] = 0.0;
|
|
424
389
|
if (!yearCategoryTotal[year]) yearCategoryTotal[year] = {};
|
|
425
390
|
if (!total[tyuri]) total[tyuri] = 0.0;
|
|
426
|
-
|
|
427
391
|
if (!yearCategoryTotal[year][tyuri]) {
|
|
428
392
|
yearCategoryTotal[year][tyuri] = 0.0;
|
|
429
393
|
}
|
|
430
|
-
|
|
431
394
|
var lit = kb.any(t, UI.ns.qu('in_USD'));
|
|
432
|
-
|
|
433
395
|
if (!lit) {
|
|
434
396
|
complain('@@ No amount in USD: ' + lit + ' for ' + t);
|
|
435
397
|
}
|
|
436
|
-
|
|
437
398
|
if (lit) {
|
|
438
399
|
var amount = parseFloat(lit.value);
|
|
439
400
|
total[tyuri] += amount;
|
|
@@ -446,7 +407,6 @@ module.exports = {
|
|
|
446
407
|
var grandTotal = 0.0;
|
|
447
408
|
var years = [];
|
|
448
409
|
var i;
|
|
449
|
-
|
|
450
410
|
for (var y in yearCategoryTotal) {
|
|
451
411
|
// @@ TODO: Write away the need for exception on next line
|
|
452
412
|
// eslint-disable-next-line no-prototype-builtins
|
|
@@ -454,24 +414,19 @@ module.exports = {
|
|
|
454
414
|
years.push(y);
|
|
455
415
|
}
|
|
456
416
|
}
|
|
457
|
-
|
|
458
417
|
years.sort();
|
|
459
418
|
var ny = years.length;
|
|
460
419
|
var cell;
|
|
461
420
|
var table = div.appendChild(dom.createElement('table'));
|
|
462
421
|
table.setAttribute('style', 'font-size: 120%; margin-left:auto; margin-right:1em; margin-top: 1em; border: 0.05em solid gray; padding: 1em;');
|
|
463
|
-
|
|
464
422
|
if (ny > 1) {
|
|
465
423
|
var header = table.appendChild(dom.createElement('tr'));
|
|
466
424
|
header.appendChild(headerCell(''));
|
|
467
|
-
|
|
468
425
|
for (i = 0; i < ny; i++) {
|
|
469
426
|
header.appendChild(headerCell(years[i]));
|
|
470
427
|
}
|
|
471
|
-
|
|
472
428
|
header.appendChild(headerCell('total'));
|
|
473
429
|
}
|
|
474
|
-
|
|
475
430
|
for (var uri in total) {
|
|
476
431
|
// @@ TODO: Write away the need for exception on next line
|
|
477
432
|
// eslint-disable-next-line no-prototype-builtins
|
|
@@ -480,42 +435,35 @@ module.exports = {
|
|
|
480
435
|
grandTotal += total[uri];
|
|
481
436
|
}
|
|
482
437
|
}
|
|
483
|
-
|
|
484
438
|
types.sort();
|
|
485
439
|
var row, label, z;
|
|
486
|
-
|
|
487
440
|
for (var j = 0; j < types.length; j++) {
|
|
488
441
|
var cat = kb.sym(types[j]);
|
|
489
442
|
row = table.appendChild(dom.createElement('tr'));
|
|
490
443
|
label = row.appendChild(dom.createElement('td'));
|
|
491
444
|
label.textContent = UI.utils.label(cat);
|
|
492
|
-
|
|
493
445
|
if (ny > 1) {
|
|
494
446
|
for (i = 0; i < ny; i++) {
|
|
495
447
|
z = yearCategoryTotal[years[i]][types[j]];
|
|
496
448
|
cell = row.appendChild(numericCell(z, true));
|
|
497
449
|
}
|
|
498
450
|
}
|
|
499
|
-
|
|
500
451
|
row.appendChild(numericCell(total[types[j]], true));
|
|
501
|
-
}
|
|
502
|
-
|
|
452
|
+
}
|
|
503
453
|
|
|
454
|
+
// Trailing totals
|
|
504
455
|
if (types.length > 1) {
|
|
505
456
|
row = table.appendChild(dom.createElement('tr'));
|
|
506
457
|
row.appendChild(headerCell('total'));
|
|
507
|
-
|
|
508
458
|
if (ny > 1) {
|
|
509
459
|
for (i = 0; i < ny; i++) {
|
|
510
460
|
z = yearTotal[years[i]];
|
|
511
461
|
cell = row.appendChild(numericCell(z ? d2(z) : ''));
|
|
512
462
|
}
|
|
513
463
|
}
|
|
514
|
-
|
|
515
464
|
cell = row.appendChild(numericCell(grandTotal));
|
|
516
465
|
cell.setAttribute('style', 'font-weight: bold; text-align: right;');
|
|
517
466
|
}
|
|
518
|
-
|
|
519
467
|
var tab = transactionTable(dom, trans);
|
|
520
468
|
tab.setAttribute('style', 'margin-left:auto; margin-right:1em; margin-top: 1em; border: padding: 1em;');
|
|
521
469
|
div.appendChild(tab);
|
|
@@ -524,12 +472,11 @@ module.exports = {
|
|
|
524
472
|
complain('Error loading transactions: ' + e);
|
|
525
473
|
});
|
|
526
474
|
};
|
|
527
|
-
|
|
528
475
|
calculations();
|
|
529
476
|
} // if
|
|
530
477
|
|
|
531
|
-
|
|
532
478
|
return div;
|
|
533
479
|
}
|
|
534
480
|
}; // ends
|
|
481
|
+
exports["default"] = _default;
|
|
535
482
|
//# sourceMappingURL=pane.js.map
|