solid-ui 2.4.21-f8053087 → 2.4.22-027fc53e
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/README.md +23 -58
- package/dist/main.js +2201 -704
- package/dist/main.js.map +1 -1
- package/lib/acl/access-controller.js +2 -2
- package/lib/acl/access-controller.js.map +1 -1
- package/lib/acl/access-groups.d.ts +1 -1
- package/lib/acl/access-groups.js +1 -1
- package/lib/acl/access-groups.js.map +1 -1
- package/lib/acl/acl-control.d.ts +2 -2
- package/lib/acl/acl-control.js +5 -5
- package/lib/acl/acl-control.js.map +1 -1
- package/lib/acl/acl.d.ts +1 -1
- package/lib/acl/acl.js +1 -1
- package/lib/acl/acl.js.map +1 -1
- package/lib/acl/add-agent-buttons.d.ts +1 -1
- package/lib/acl/add-agent-buttons.js +1 -1
- package/lib/acl/add-agent-buttons.js.map +1 -1
- package/lib/acl/styles.d.ts +1 -1
- package/lib/acl/styles.js +1 -1
- package/lib/acl/styles.js.map +1 -1
- package/lib/chat/bookmarks.js +1 -2
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/infinite.js.map +1 -1
- package/lib/iconBase.d.ts.map +1 -1
- package/lib/iconBase.js +4 -3
- package/lib/iconBase.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/jss/index.d.ts +2 -2
- package/lib/jss/index.js +2 -2
- package/lib/jss/index.js.map +1 -1
- package/lib/login/login.d.ts +55 -51
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +319 -370
- package/lib/login/login.js.map +1 -1
- package/lib/participation.js +1 -1
- package/lib/participation.js.map +1 -1
- package/lib/style_multiSelect.js +67 -0
- package/lib/style_multiSelect.js.map +1 -0
- package/lib/tabs.d.ts +2 -2
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +39 -24
- package/lib/tabs.js.map +1 -1
- package/lib/utils/headerFooterHelpers.js +24 -19
- package/lib/utils/headerFooterHelpers.js.map +1 -1
- package/lib/utils/label.js +1 -1
- package/lib/utils/label.js.map +1 -1
- package/lib/versionInfo.js +7 -7
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons.d.ts.map +1 -1
- package/lib/widgets/buttons.js +2 -0
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/error.d.ts +0 -12
- package/lib/widgets/error.d.ts.map +1 -1
- package/lib/widgets/error.js +5 -0
- package/lib/widgets/error.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms/autocomplete/publicData.js +1 -1
- package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
- package/lib/widgets/forms.js +427 -161
- package/lib/widgets/forms.js.map +1 -1
- package/lib/widgets/multiSelect.js +784 -0
- package/lib/widgets/multiSelect.js.map +1 -0
- package/package.json +14 -11
package/dist/main.js
CHANGED
|
@@ -219,7 +219,7 @@ var AccessController = /*#__PURE__*/function () {
|
|
|
219
219
|
value: function renderTemporaryStatus(message) {
|
|
220
220
|
var _this5 = this;
|
|
221
221
|
|
|
222
|
-
// @@ TODO Introduce better system for error notification to user https://github.com/
|
|
222
|
+
// @@ TODO Introduce better system for error notification to user https://github.com/solidos/mashlib/issues/87
|
|
223
223
|
this.statusElement.classList.add(this.classes.aclControlBoxStatusRevealed);
|
|
224
224
|
this.statusElement.innerText = message;
|
|
225
225
|
this.statusElement.classList.add(this.classes.temporaryStatusInit);
|
|
@@ -233,7 +233,7 @@ var AccessController = /*#__PURE__*/function () {
|
|
|
233
233
|
}, {
|
|
234
234
|
key: "renderStatus",
|
|
235
235
|
value: function renderStatus(message) {
|
|
236
|
-
// @@ TODO Introduce better system for error notification to user https://github.com/
|
|
236
|
+
// @@ TODO Introduce better system for error notification to user https://github.com/solidos/mashlib/issues/87
|
|
237
237
|
this.statusElement.classList.toggle(this.classes.aclControlBoxStatusRevealed, !!message);
|
|
238
238
|
this.statusElement.innerText = message;
|
|
239
239
|
}
|
|
@@ -555,7 +555,7 @@ var EXPLANATION = {
|
|
|
555
555
|
|
|
556
556
|
/**
|
|
557
557
|
* Renders the table of Owners, Editors, Posters, Submitters, Viewers
|
|
558
|
-
* for https://github.com/
|
|
558
|
+
* for https://github.com/solidos/userguide/blob/main/views/sharing/userguide.md
|
|
559
559
|
*/
|
|
560
560
|
var AccessGroups = /*#__PURE__*/function () {
|
|
561
561
|
// @@ was LiveStore but does not need to be connected to web
|
|
@@ -1058,7 +1058,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
1058
1058
|
|
|
1059
1059
|
/**
|
|
1060
1060
|
* Functions for rendering the ACL User Interface.
|
|
1061
|
-
* See https://github.com/
|
|
1061
|
+
* See https://github.com/solidos/userguide/blob/main/views/sharing/userguide.md#view
|
|
1062
1062
|
* for a screenshot.
|
|
1063
1063
|
* @packageDocumentation
|
|
1064
1064
|
*/
|
|
@@ -1155,7 +1155,7 @@ function shortNameForFolder(x) {
|
|
|
1155
1155
|
if (slash >= 0) {
|
|
1156
1156
|
str = str.slice(slash + 1);
|
|
1157
1157
|
} // Return the folder's filename, or '/' if nothing found
|
|
1158
|
-
// (but see https://github.com/
|
|
1158
|
+
// (but see https://github.com/solidos/solid-ui/issues/196
|
|
1159
1159
|
// regarding whether this happens at the domain root or
|
|
1160
1160
|
// not)
|
|
1161
1161
|
|
|
@@ -1168,7 +1168,7 @@ function shortNameForFolder(x) {
|
|
|
1168
1168
|
* Presumably the '5' is a version number of some sort,
|
|
1169
1169
|
* but all we know is it was already called ACLControlBox5
|
|
1170
1170
|
* when it was introduced into solid-ui in
|
|
1171
|
-
* https://github.com/
|
|
1171
|
+
* https://github.com/solidos/solid-ui/commit/948b874bd93e7bf5160e6e224821b888f07d15f3#diff-4192a29f38a0ababd563b36b47eba5bbR54
|
|
1172
1172
|
*/
|
|
1173
1173
|
|
|
1174
1174
|
|
|
@@ -1285,13 +1285,13 @@ function getDirectory(doc) {
|
|
|
1285
1285
|
function isStorage(doc, aclDoc, store) {
|
|
1286
1286
|
// @@ TODO: The methods used for targetIsStorage are HACKs - it should not be relied upon, and work is
|
|
1287
1287
|
// @@ underway to standardize a behavior that does not rely upon this hack
|
|
1288
|
-
// @@ hopefully fixed as part of https://github.com/
|
|
1288
|
+
// @@ hopefully fixed as part of https://github.com/solidos/data-interoperability-panel/issues/10
|
|
1289
1289
|
return store.holds(doc, ns.rdf('type'), ns.space('Storage'), aclDoc);
|
|
1290
1290
|
}
|
|
1291
1291
|
|
|
1292
1292
|
function hasProtectedAcl(targetDoc) {
|
|
1293
1293
|
// @@ TODO: This is hacky way of knowing whether or not a certain ACL file can be removed
|
|
1294
|
-
// Hopefully we'll find a better, standardized solution to this - https://github.com/
|
|
1294
|
+
// Hopefully we'll find a better, standardized solution to this - https://github.com/solidos/specification/issues/37
|
|
1295
1295
|
return targetDoc.uri === targetDoc.site().uri;
|
|
1296
1296
|
}
|
|
1297
1297
|
/** @internal */
|
|
@@ -1360,7 +1360,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
1360
1360
|
|
|
1361
1361
|
/**
|
|
1362
1362
|
* Non-UI functions for access control.
|
|
1363
|
-
* See https://github.com/
|
|
1363
|
+
* See https://github.com/solidos/web-access-control-spec
|
|
1364
1364
|
* for the spec that defines how ACL documents work.
|
|
1365
1365
|
* @packageDocumentation
|
|
1366
1366
|
*/
|
|
@@ -1962,7 +1962,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
1962
1962
|
|
|
1963
1963
|
/**
|
|
1964
1964
|
* Renders the Sharing pane's "+" button and the menus behind it,
|
|
1965
|
-
* see https://github.com/
|
|
1965
|
+
* see https://github.com/solidos/userguide/blob/main/views/sharing/userguide.md#add
|
|
1966
1966
|
*/
|
|
1967
1967
|
var AddAgentButtons = /*#__PURE__*/function () {
|
|
1968
1968
|
function AddAgentButtons(groupList) {
|
|
@@ -2531,7 +2531,7 @@ exports.styles = void 0;
|
|
|
2531
2531
|
|
|
2532
2532
|
/**
|
|
2533
2533
|
* Contains CSS styles for the Sharing pane,
|
|
2534
|
-
* see https://github.com/
|
|
2534
|
+
* see https://github.com/solidos/userguide/blob/main/views/sharing/userguide.md
|
|
2535
2535
|
* @packageDocumentation
|
|
2536
2536
|
*/
|
|
2537
2537
|
var styles = {
|
|
@@ -2745,8 +2745,7 @@ function updatePromise(del, ins) {
|
|
|
2745
2745
|
}); // callback
|
|
2746
2746
|
|
|
2747
2747
|
}); // promise
|
|
2748
|
-
}
|
|
2749
|
-
|
|
2748
|
+
}
|
|
2750
2749
|
/* Bookmarking
|
|
2751
2750
|
*/
|
|
2752
2751
|
|
|
@@ -7102,11 +7101,12 @@ var _debug = __webpack_require__(/*! ./debug */ "./lib/debug.js");
|
|
|
7102
7101
|
*
|
|
7103
7102
|
* You can also use it if you want to just run a mashlib whhich takes its
|
|
7104
7103
|
* icons seved by other than github.
|
|
7105
|
-
*/
|
|
7104
|
+
*/
|
|
7106
7105
|
|
|
7107
7106
|
/* eslint-disable multiline-ternary */
|
|
7108
|
-
// Do not export.
|
|
7109
|
-
var iconsOnGithub = 'https://
|
|
7107
|
+
// Do not export. Always us this module to find the icons, as they vary
|
|
7108
|
+
var iconsOnGithub = 'https://solidos.github.io/solid-ui/src'; // changed org 2022-05
|
|
7109
|
+
|
|
7110
7110
|
var icons = module.scriptURI // Firefox extension
|
|
7111
7111
|
? {
|
|
7112
7112
|
iconBase: module.scriptURI.slice(0, module.scriptURI.lastIndexOf('/')) + '/icons/',
|
|
@@ -7162,7 +7162,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
7162
7162
|
SOFTWARE.
|
|
7163
7163
|
|
|
7164
7164
|
If you would like to know more about the solid Solid project, please see
|
|
7165
|
-
https://github.com/
|
|
7165
|
+
https://github.com/solidos/solid
|
|
7166
7166
|
*/
|
|
7167
7167
|
|
|
7168
7168
|
/**
|
|
@@ -7436,7 +7436,7 @@ var stylesheetsMap = new Map();
|
|
|
7436
7436
|
/**
|
|
7437
7437
|
* returns a StyleSheet object.
|
|
7438
7438
|
* See https://cssinjs.org/ for more info about JSS.
|
|
7439
|
-
* (despite the name, see https://github.com/
|
|
7439
|
+
* (despite the name, see https://github.com/solidos/solid-ui/issues/199)
|
|
7440
7440
|
*/
|
|
7441
7441
|
|
|
7442
7442
|
function getClasses(insertionPoint, styles) {
|
|
@@ -7446,7 +7446,7 @@ function getClasses(insertionPoint, styles) {
|
|
|
7446
7446
|
/**
|
|
7447
7447
|
* returns a JSS object.
|
|
7448
7448
|
* See https://cssinjs.org/ for more info about JSS.
|
|
7449
|
-
* (despite the name, see https://github.com/
|
|
7449
|
+
* (despite the name, see https://github.com/solidos/solid-ui/issues/199)
|
|
7450
7450
|
*/
|
|
7451
7451
|
|
|
7452
7452
|
|
|
@@ -7754,7 +7754,9 @@ exports.loginStatusBox = loginStatusBox;
|
|
|
7754
7754
|
exports.newAppInstance = newAppInstance;
|
|
7755
7755
|
exports.registrationControl = registrationControl;
|
|
7756
7756
|
exports.registrationList = registrationList;
|
|
7757
|
+
exports.renderScopeHeadingRow = renderScopeHeadingRow;
|
|
7757
7758
|
exports.renderSignInPopup = renderSignInPopup;
|
|
7759
|
+
exports.scopeLabel = scopeLabel;
|
|
7758
7760
|
exports.selectWorkspace = selectWorkspace;
|
|
7759
7761
|
|
|
7760
7762
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
@@ -7775,7 +7777,7 @@ var _signup = __webpack_require__(/*! ../signup/signup.js */ "./lib/signup/signu
|
|
|
7775
7777
|
|
|
7776
7778
|
var _style = __webpack_require__(/*! ../style */ "./lib/style.js");
|
|
7777
7779
|
|
|
7778
|
-
var
|
|
7780
|
+
var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
|
|
7779
7781
|
|
|
7780
7782
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
7781
7783
|
|
|
@@ -7783,37 +7785,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
7783
7785
|
|
|
7784
7786
|
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; }
|
|
7785
7787
|
|
|
7788
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
7789
|
+
|
|
7790
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7791
|
+
|
|
7792
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
7793
|
+
|
|
7794
|
+
var store = _solidLogic.solidLogicSingleton.store;
|
|
7786
7795
|
/**
|
|
7787
|
-
*
|
|
7788
|
-
* Type index management
|
|
7796
|
+
* Resolves with the logged in user's WebID
|
|
7789
7797
|
*
|
|
7790
|
-
*
|
|
7791
|
-
* holds various RDF symbols, add to it, and return a promise of it.
|
|
7792
|
-
*
|
|
7793
|
-
* * `me` RDF symbol for the user's WebID
|
|
7794
|
-
* * `publicProfile` The user's public profile, iff loaded
|
|
7795
|
-
* * `preferencesFile` The user's personal preference file, iff loaded
|
|
7796
|
-
* * `index.public` The user's public type index file
|
|
7797
|
-
* * `index.private` The user's private type index file
|
|
7798
|
-
*
|
|
7799
|
-
* Not RDF symbols:
|
|
7800
|
-
* * `noun` A string in english for the type of thing -- like "address book"
|
|
7801
|
-
* * `instance` An array of nodes which are existing instances
|
|
7802
|
-
* * `containers` An array of nodes of containers of instances
|
|
7803
|
-
* * `div` A DOM element where UI can be displayed
|
|
7804
|
-
* * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages
|
|
7805
|
-
* *
|
|
7806
|
-
* * Vocabulary: "load" loads a file if it exists;
|
|
7807
|
-
* * 'Ensure" CREATES the file if it does not exist (if it can) and then loads it.
|
|
7808
|
-
* @packageDocumentation
|
|
7798
|
+
* @param context
|
|
7809
7799
|
*/
|
|
7810
|
-
|
|
7811
|
-
/**
|
|
7812
|
-
* Resolves with the logged in user's WebID
|
|
7813
|
-
*
|
|
7814
|
-
* @param context
|
|
7815
|
-
*/
|
|
7816
7800
|
// used to be logIn
|
|
7801
|
+
|
|
7817
7802
|
function ensureLoggedIn(context) {
|
|
7818
7803
|
var me = _solidLogic.authn.currentUser();
|
|
7819
7804
|
|
|
@@ -7855,7 +7840,7 @@ function ensureLoggedIn(context) {
|
|
|
7855
7840
|
// used to be logInLoadPreferences
|
|
7856
7841
|
|
|
7857
7842
|
|
|
7858
|
-
function ensureLoadedPreferences(
|
|
7843
|
+
function ensureLoadedPreferences(_x) {
|
|
7859
7844
|
return _ensureLoadedPreferences.apply(this, arguments);
|
|
7860
7845
|
}
|
|
7861
7846
|
/**
|
|
@@ -8002,7 +7987,7 @@ function _ensureLoadedPreferences() {
|
|
|
8002
7987
|
return _ensureLoadedPreferences.apply(this, arguments);
|
|
8003
7988
|
}
|
|
8004
7989
|
|
|
8005
|
-
function ensureLoadedProfile(
|
|
7990
|
+
function ensureLoadedProfile(_x2) {
|
|
8006
7991
|
return _ensureLoadedProfile.apply(this, arguments);
|
|
8007
7992
|
}
|
|
8008
7993
|
/**
|
|
@@ -8010,6 +7995,8 @@ function ensureLoadedProfile(_x3) {
|
|
|
8010
7995
|
*
|
|
8011
7996
|
* 2016-12-11 change to include forClass arc a la
|
|
8012
7997
|
* https://github.com/solid/solid/blob/main/proposals/data-discovery.md
|
|
7998
|
+
* This is now legacy; should instead use solid-logic getAppInstances
|
|
7999
|
+
* leaving the `isPublic` param undefined will bring in community index things, too
|
|
8013
8000
|
*/
|
|
8014
8001
|
|
|
8015
8002
|
|
|
@@ -8074,210 +8061,139 @@ function _ensureLoadedProfile() {
|
|
|
8074
8061
|
return _ensureLoadedProfile.apply(this, arguments);
|
|
8075
8062
|
}
|
|
8076
8063
|
|
|
8077
|
-
function findAppInstances(_x4, _x5
|
|
8064
|
+
function findAppInstances(_x3, _x4, _x5) {
|
|
8078
8065
|
return _findAppInstances.apply(this, arguments);
|
|
8079
8066
|
}
|
|
8080
|
-
/**
|
|
8081
|
-
* UI to control registration of instance
|
|
8082
|
-
*/
|
|
8083
|
-
|
|
8084
8067
|
|
|
8085
8068
|
function _findAppInstances() {
|
|
8086
8069
|
_findAppInstances = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(context, theClass, isPublic) {
|
|
8087
|
-
var
|
|
8070
|
+
var items;
|
|
8088
8071
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
8089
8072
|
while (1) {
|
|
8090
8073
|
switch (_context6.prev = _context6.next) {
|
|
8091
8074
|
case 0:
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
};
|
|
8095
|
-
|
|
8096
|
-
if (!(isPublic === undefined)) {
|
|
8097
|
-
_context6.next = 7;
|
|
8075
|
+
if (!context.me) {
|
|
8076
|
+
_context6.next = 6;
|
|
8098
8077
|
break;
|
|
8099
8078
|
}
|
|
8100
8079
|
|
|
8101
|
-
_context6.next =
|
|
8102
|
-
return
|
|
8080
|
+
_context6.next = 3;
|
|
8081
|
+
return (0, _solidLogic.getScopedAppInstances)(store, theClass, context.me);
|
|
8103
8082
|
|
|
8104
|
-
case
|
|
8105
|
-
_context6.
|
|
8106
|
-
|
|
8083
|
+
case 3:
|
|
8084
|
+
_context6.t0 = _context6.sent;
|
|
8085
|
+
_context6.next = 7;
|
|
8086
|
+
break;
|
|
8107
8087
|
|
|
8108
8088
|
case 6:
|
|
8109
|
-
|
|
8089
|
+
_context6.t0 = [];
|
|
8110
8090
|
|
|
8111
8091
|
case 7:
|
|
8112
|
-
|
|
8113
|
-
_context6.next = 10;
|
|
8114
|
-
return isPublic ? ensureLoadedProfile(context) : ensureLoadedPreferences(context);
|
|
8115
|
-
|
|
8116
|
-
case 10:
|
|
8117
|
-
_context6.next = 15;
|
|
8118
|
-
break;
|
|
8119
|
-
|
|
8120
|
-
case 12:
|
|
8121
|
-
_context6.prev = 12;
|
|
8122
|
-
_context6.t0 = _context6["catch"](7);
|
|
8123
|
-
widgets.complain(context, "loadIndex: login and load problem ".concat(_context6.t0));
|
|
8124
|
-
|
|
8125
|
-
case 15:
|
|
8126
|
-
// console.log('awaited LogInLoad!', context)
|
|
8127
|
-
visibility = isPublic ? 'public' : 'private';
|
|
8128
|
-
_context6.prev = 16;
|
|
8129
|
-
_context6.next = 19;
|
|
8130
|
-
return (0, _solidLogic.loadIndex)(context, isPublic);
|
|
8131
|
-
|
|
8132
|
-
case 19:
|
|
8133
|
-
_context6.next = 24;
|
|
8134
|
-
break;
|
|
8135
|
-
|
|
8136
|
-
case 21:
|
|
8137
|
-
_context6.prev = 21;
|
|
8138
|
-
_context6.t1 = _context6["catch"](16);
|
|
8139
|
-
debug.error(_context6.t1);
|
|
8140
|
-
|
|
8141
|
-
case 24:
|
|
8142
|
-
index = context.index;
|
|
8143
|
-
thisIndex = index[visibility];
|
|
8144
|
-
registrations = thisIndex.map(function (ix) {
|
|
8145
|
-
return _solidLogic.solidLogicSingleton.store.each(undefined, ns.solid('forClass'), theClass, ix);
|
|
8146
|
-
}).reduce(function (acc, curr) {
|
|
8147
|
-
return acc.concat(curr);
|
|
8148
|
-
}, []);
|
|
8149
|
-
instances = registrations.map(function (reg) {
|
|
8150
|
-
return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instance'));
|
|
8151
|
-
}).reduce(function (acc, curr) {
|
|
8152
|
-
return acc.concat(curr);
|
|
8153
|
-
}, []);
|
|
8154
|
-
containers = registrations.map(function (reg) {
|
|
8155
|
-
return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instanceContainer'));
|
|
8156
|
-
}).reduce(function (acc, curr) {
|
|
8157
|
-
return acc.concat(curr);
|
|
8158
|
-
}, []);
|
|
8159
|
-
context.instances = context.instances || [];
|
|
8160
|
-
context.instances = unique(context.instances.concat(instances));
|
|
8161
|
-
context.containers = context.containers || [];
|
|
8162
|
-
context.containers = unique(context.containers.concat(containers));
|
|
8163
|
-
|
|
8164
|
-
if (containers.length) {
|
|
8165
|
-
_context6.next = 35;
|
|
8166
|
-
break;
|
|
8167
|
-
}
|
|
8168
|
-
|
|
8169
|
-
return _context6.abrupt("return", context);
|
|
8092
|
+
items = _context6.t0;
|
|
8170
8093
|
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
case 40:
|
|
8181
|
-
_context6.prev = 40;
|
|
8182
|
-
_context6.t2 = _context6["catch"](35);
|
|
8183
|
-
e = new Error("[FAI] Unable to load containers".concat(_context6.t2));
|
|
8184
|
-
debug.log(e); // complain
|
|
8185
|
-
|
|
8186
|
-
widgets.complain(context, "Error looking for ".concat(_index.utils.label(theClass), ": ").concat(_context6.t2)); // but then ignore it
|
|
8187
|
-
// throw new Error(e)
|
|
8188
|
-
|
|
8189
|
-
case 45:
|
|
8190
|
-
i = 0;
|
|
8191
|
-
|
|
8192
|
-
case 46:
|
|
8193
|
-
if (!(i < containers.length)) {
|
|
8194
|
-
_context6.next = 56;
|
|
8195
|
-
break;
|
|
8094
|
+
if (isPublic === true) {
|
|
8095
|
+
// old API - not recommended!
|
|
8096
|
+
items = items.filter(function (item) {
|
|
8097
|
+
return item.scope.label === 'public';
|
|
8098
|
+
});
|
|
8099
|
+
} else if (isPublic === false) {
|
|
8100
|
+
items = items.filter(function (item) {
|
|
8101
|
+
return item.scope.label === 'private';
|
|
8102
|
+
});
|
|
8196
8103
|
}
|
|
8197
8104
|
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
_context6.next = 51;
|
|
8201
|
-
return _solidLogic.solidLogicSingleton.getContainerMembers(cont.value);
|
|
8202
|
-
|
|
8203
|
-
case 51:
|
|
8204
|
-
_context6.t4 = _context6.sent.map(function (uri) {
|
|
8205
|
-
return _solidLogic.solidLogicSingleton.store.sym(uri);
|
|
8105
|
+
context.instances = items.map(function (item) {
|
|
8106
|
+
return item.instance;
|
|
8206
8107
|
});
|
|
8207
|
-
context.instances = _context6.t3.concat.call(_context6.t3, _context6.t4);
|
|
8208
|
-
|
|
8209
|
-
case 53:
|
|
8210
|
-
i++;
|
|
8211
|
-
_context6.next = 46;
|
|
8212
|
-
break;
|
|
8213
|
-
|
|
8214
|
-
case 56:
|
|
8215
8108
|
return _context6.abrupt("return", context);
|
|
8216
8109
|
|
|
8217
|
-
case
|
|
8110
|
+
case 11:
|
|
8218
8111
|
case "end":
|
|
8219
8112
|
return _context6.stop();
|
|
8220
8113
|
}
|
|
8221
8114
|
}
|
|
8222
|
-
}, _callee6
|
|
8115
|
+
}, _callee6);
|
|
8223
8116
|
}));
|
|
8224
8117
|
return _findAppInstances.apply(this, arguments);
|
|
8225
8118
|
}
|
|
8226
8119
|
|
|
8227
|
-
function
|
|
8228
|
-
|
|
8120
|
+
function scopeLabel(context, scope) {
|
|
8121
|
+
var mine = context.me && context.me.sameTerm(scope.agent);
|
|
8122
|
+
var name = mine ? '' : utils.label(scope.agent) + ' ';
|
|
8123
|
+
return "".concat(name).concat(scope.label);
|
|
8229
8124
|
}
|
|
8230
8125
|
/**
|
|
8231
|
-
|
|
8232
|
-
|
|
8126
|
+
* UI to control registration of instance
|
|
8127
|
+
*/
|
|
8233
8128
|
|
|
8234
8129
|
|
|
8130
|
+
function registrationControl(_x6, _x7, _x8) {
|
|
8131
|
+
return _registrationControl.apply(this, arguments);
|
|
8132
|
+
}
|
|
8133
|
+
|
|
8235
8134
|
function _registrationControl() {
|
|
8236
8135
|
_registrationControl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(context, instance, theClass) {
|
|
8237
|
-
var dom, box,
|
|
8136
|
+
var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row;
|
|
8238
8137
|
|
|
8239
8138
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
8240
8139
|
while (1) {
|
|
8241
8140
|
switch (_context7.prev = _context7.next) {
|
|
8242
8141
|
case 0:
|
|
8142
|
+
renderScopeCheckbox = function _renderScopeCheckbox(scope) {
|
|
8143
|
+
var statements = registrationStatements(scope.index);
|
|
8144
|
+
var name = scopeLabel(context, scope);
|
|
8145
|
+
var label = "".concat(name, " link to this ").concat(context.noun);
|
|
8146
|
+
return widgets.buildCheckboxForm(context.dom, _solidLogic.solidLogicSingleton.store, label, null, statements, form, scope.index);
|
|
8147
|
+
};
|
|
8148
|
+
|
|
8149
|
+
registrationStatements = function _registrationStatemen(index) {
|
|
8150
|
+
var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
|
|
8151
|
+
|
|
8152
|
+
var reg = registrations.length ? registrations[0] : widgets.newThing(index);
|
|
8153
|
+
return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
|
|
8154
|
+
};
|
|
8155
|
+
|
|
8156
|
+
/// / body of registrationControl
|
|
8243
8157
|
dom = context.dom;
|
|
8244
8158
|
|
|
8245
8159
|
if (!(!dom || !context.div)) {
|
|
8246
|
-
_context7.next =
|
|
8160
|
+
_context7.next = 5;
|
|
8247
8161
|
break;
|
|
8248
8162
|
}
|
|
8249
8163
|
|
|
8250
|
-
|
|
8164
|
+
throw new Error('registrationControl: need dom and div');
|
|
8251
8165
|
|
|
8252
|
-
case
|
|
8166
|
+
case 5:
|
|
8253
8167
|
box = dom.createElement('div');
|
|
8254
8168
|
context.div.appendChild(box);
|
|
8255
8169
|
context.me = _solidLogic.authn.currentUser(); // @@
|
|
8256
8170
|
|
|
8257
|
-
|
|
8258
|
-
|
|
8171
|
+
me = context.me;
|
|
8172
|
+
|
|
8173
|
+
if (me) {
|
|
8174
|
+
_context7.next = 12;
|
|
8259
8175
|
break;
|
|
8260
8176
|
}
|
|
8261
8177
|
|
|
8262
8178
|
box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
|
|
8263
8179
|
return _context7.abrupt("return", context);
|
|
8264
8180
|
|
|
8265
|
-
case 9:
|
|
8266
|
-
_context7.prev = 9;
|
|
8267
|
-
_context7.next = 12;
|
|
8268
|
-
return (0, _solidLogic.ensureTypeIndexes)(context);
|
|
8269
|
-
|
|
8270
8181
|
case 12:
|
|
8271
|
-
|
|
8272
|
-
_context7.next =
|
|
8273
|
-
|
|
8182
|
+
_context7.prev = 12;
|
|
8183
|
+
_context7.next = 15;
|
|
8184
|
+
return (0, _solidLogic.loadAllTypeIndexes)(store, me);
|
|
8274
8185
|
|
|
8275
8186
|
case 15:
|
|
8276
|
-
|
|
8277
|
-
_context7.
|
|
8187
|
+
scopes = _context7.sent;
|
|
8188
|
+
_context7.next = 23;
|
|
8189
|
+
break;
|
|
8190
|
+
|
|
8191
|
+
case 18:
|
|
8192
|
+
_context7.prev = 18;
|
|
8193
|
+
_context7.t0 = _context7["catch"](12);
|
|
8278
8194
|
|
|
8279
8195
|
if (context.div && context.preferencesFileError) {
|
|
8280
|
-
msg = '(
|
|
8196
|
+
msg = '(Lists of stuff not available)';
|
|
8281
8197
|
context.div.appendChild(dom.createElement('p')).textContent = msg;
|
|
8282
8198
|
} else if (context.div) {
|
|
8283
8199
|
msg = "registrationControl: Type indexes not available: ".concat(_context7.t0);
|
|
@@ -8285,168 +8201,201 @@ function _registrationControl() {
|
|
|
8285
8201
|
}
|
|
8286
8202
|
|
|
8287
8203
|
debug.log(msg);
|
|
8204
|
+
return _context7.abrupt("return", context);
|
|
8288
8205
|
|
|
8289
|
-
case
|
|
8290
|
-
box.innerHTML = '<table><tbody
|
|
8206
|
+
case 23:
|
|
8207
|
+
box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
|
|
8291
8208
|
|
|
8292
8209
|
box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
|
|
8293
8210
|
tbody = box.children[0].children[0];
|
|
8294
8211
|
form = new _rdflib.BlankNode(); // @@ say for now
|
|
8295
8212
|
|
|
8296
|
-
|
|
8297
|
-
var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
|
|
8298
|
-
|
|
8299
|
-
var reg = registrations.length ? registrations[0] : widgets.newThing(index);
|
|
8300
|
-
return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
|
|
8301
|
-
};
|
|
8213
|
+
_iterator = _createForOfIteratorHelper(scopes);
|
|
8302
8214
|
|
|
8303
8215
|
try {
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
}
|
|
8309
|
-
|
|
8310
|
-
if (context2.index && context2.index["private"] && context2.index["private"].length > 0) {
|
|
8311
|
-
index = context2.index["private"][0];
|
|
8312
|
-
statements = registrationStatements(index);
|
|
8313
|
-
tbody.children[1].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Personal note of this ".concat(context2.noun), null, statements, form, index));
|
|
8216
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
8217
|
+
scope = _step.value;
|
|
8218
|
+
row = tbody.appendChild(dom.createElement('tr'));
|
|
8219
|
+
row.appendChild(renderScopeCheckbox(scope)); // @@ index
|
|
8314
8220
|
}
|
|
8315
|
-
} catch (
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
context.div.appendChild(widgets.errorMessageBlock(context.dom, e));
|
|
8320
|
-
}
|
|
8321
|
-
|
|
8322
|
-
debug.log(_msg);
|
|
8221
|
+
} catch (err) {
|
|
8222
|
+
_iterator.e(err);
|
|
8223
|
+
} finally {
|
|
8224
|
+
_iterator.f();
|
|
8323
8225
|
}
|
|
8324
8226
|
|
|
8325
|
-
return _context7.abrupt("return",
|
|
8227
|
+
return _context7.abrupt("return", context);
|
|
8326
8228
|
|
|
8327
|
-
case
|
|
8229
|
+
case 30:
|
|
8328
8230
|
case "end":
|
|
8329
8231
|
return _context7.stop();
|
|
8330
8232
|
}
|
|
8331
8233
|
}
|
|
8332
|
-
}, _callee7, null, [[
|
|
8234
|
+
}, _callee7, null, [[12, 18]]);
|
|
8333
8235
|
}));
|
|
8334
8236
|
return _registrationControl.apply(this, arguments);
|
|
8335
8237
|
}
|
|
8336
8238
|
|
|
8337
|
-
function
|
|
8338
|
-
|
|
8239
|
+
function renderScopeHeadingRow(context, store, scope) {
|
|
8240
|
+
var backgroundColor = {
|
|
8241
|
+
"private": '#fee',
|
|
8242
|
+
"public": '#efe'
|
|
8243
|
+
};
|
|
8244
|
+
var dom = context.dom;
|
|
8245
|
+
var name = scopeLabel(context, scope);
|
|
8246
|
+
var row = dom.createElement('tr');
|
|
8247
|
+
var cell = row.appendChild(dom.createElement('td'));
|
|
8248
|
+
cell.setAttribute('colspan', '3');
|
|
8249
|
+
cell.style.backgoundColor = backgroundColor[scope.label] || 'white';
|
|
8250
|
+
var header = cell.appendChild(dom.createElement('h3'));
|
|
8251
|
+
header.textContent = name + ' links';
|
|
8252
|
+
header.style.textAlign = 'left';
|
|
8253
|
+
return row;
|
|
8339
8254
|
}
|
|
8255
|
+
/**
|
|
8256
|
+
* UI to List at all registered things
|
|
8257
|
+
*/
|
|
8258
|
+
|
|
8259
|
+
|
|
8260
|
+
function registrationList(_x9, _x10) {
|
|
8261
|
+
return _registrationList.apply(this, arguments);
|
|
8262
|
+
} // registrationList
|
|
8263
|
+
|
|
8340
8264
|
|
|
8341
8265
|
function _registrationList() {
|
|
8342
|
-
_registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
8343
|
-
var dom, div, box;
|
|
8344
|
-
|
|
8266
|
+
_registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(context, options) {
|
|
8267
|
+
var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop;
|
|
8268
|
+
|
|
8269
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
8345
8270
|
while (1) {
|
|
8346
|
-
switch (
|
|
8271
|
+
switch (_context9.prev = _context9.next) {
|
|
8347
8272
|
case 0:
|
|
8348
|
-
dom =
|
|
8349
|
-
div =
|
|
8273
|
+
dom = context.dom;
|
|
8274
|
+
div = context.div;
|
|
8350
8275
|
box = dom.createElement('div');
|
|
8351
8276
|
div.appendChild(box);
|
|
8352
|
-
|
|
8277
|
+
context.me = _solidLogic.authn.currentUser(); // @@
|
|
8353
8278
|
|
|
8354
|
-
if (
|
|
8355
|
-
|
|
8279
|
+
if (context.me) {
|
|
8280
|
+
_context9.next = 8;
|
|
8356
8281
|
break;
|
|
8357
8282
|
}
|
|
8358
8283
|
|
|
8359
8284
|
box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
|
|
8360
|
-
return
|
|
8285
|
+
return _context9.abrupt("return", context);
|
|
8361
8286
|
|
|
8362
8287
|
case 8:
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
// tbody will be inserted anyway
|
|
8367
|
-
box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
|
|
8368
|
-
var table = box.firstChild;
|
|
8369
|
-
var ix = [];
|
|
8370
|
-
var sts = [];
|
|
8371
|
-
var vs = ['private', 'public'];
|
|
8372
|
-
vs.forEach(function (visibility) {
|
|
8373
|
-
if (context.index && context.index[visibility].length > 0 && options[visibility]) {
|
|
8374
|
-
ix = ix.concat(context.index[visibility][0]);
|
|
8375
|
-
sts = sts.concat(_solidLogic.solidLogicSingleton.store.statementsMatching(undefined, ns.solid('instance'), undefined, context.index[visibility][0]));
|
|
8376
|
-
}
|
|
8377
|
-
});
|
|
8288
|
+
_context9.next = 10;
|
|
8289
|
+
return (0, _solidLogic.loadAllTypeIndexes)(store, context.me);
|
|
8378
8290
|
|
|
8379
|
-
|
|
8380
|
-
|
|
8291
|
+
case 10:
|
|
8292
|
+
scopes = _context9.sent;
|
|
8293
|
+
// includes community indexes
|
|
8294
|
+
// console.log('@@ registrationList ', scopes)
|
|
8295
|
+
box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
|
|
8381
8296
|
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8297
|
+
box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
|
|
8298
|
+
table = box.firstChild;
|
|
8299
|
+
tbody = table.firstChild;
|
|
8300
|
+
_iterator2 = _createForOfIteratorHelper(scopes);
|
|
8301
|
+
_context9.prev = 16;
|
|
8302
|
+
|
|
8303
|
+
_iterator2.s();
|
|
8304
|
+
|
|
8305
|
+
case 18:
|
|
8306
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
8307
|
+
_context9.next = 30;
|
|
8308
|
+
break;
|
|
8309
|
+
}
|
|
8388
8310
|
|
|
8311
|
+
scope = _step2.value;
|
|
8312
|
+
// need some predicate for listing/adding agents
|
|
8313
|
+
headingRow = renderScopeHeadingRow(context, store, scope);
|
|
8314
|
+
tbody.appendChild(headingRow);
|
|
8315
|
+
_context9.next = 24;
|
|
8316
|
+
return (0, _solidLogic.getScopedAppsFromIndex)(store, scope, options.type || null);
|
|
8317
|
+
|
|
8318
|
+
case 24:
|
|
8319
|
+
items = _context9.sent;
|
|
8320
|
+
// any class
|
|
8321
|
+
if (items.length === 0) headingRow.style.display = 'none'; // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
|
|
8322
|
+
|
|
8323
|
+
_iterator3 = _createForOfIteratorHelper(items);
|
|
8324
|
+
|
|
8325
|
+
try {
|
|
8326
|
+
_loop = function _loop() {
|
|
8327
|
+
var item = _step3.value;
|
|
8328
|
+
var row = widgets.personTR(dom, ns.solid('instance'), item.instance, {
|
|
8329
|
+
deleteFunction: function () {
|
|
8330
|
+
var _deleteFunction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
8331
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
8332
|
+
while (1) {
|
|
8333
|
+
switch (_context8.prev = _context8.next) {
|
|
8334
|
+
case 0:
|
|
8335
|
+
_context8.next = 2;
|
|
8336
|
+
return (0, _solidLogic.deleteTypeIndexRegistration)(store, item);
|
|
8337
|
+
|
|
8338
|
+
case 2:
|
|
8339
|
+
tbody.removeChild(row);
|
|
8340
|
+
|
|
8341
|
+
case 3:
|
|
8342
|
+
case "end":
|
|
8343
|
+
return _context8.stop();
|
|
8344
|
+
}
|
|
8345
|
+
}
|
|
8346
|
+
}, _callee8);
|
|
8347
|
+
}));
|
|
8389
8348
|
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
table.appendChild(widgets.personTR(dom, ns.solid('instance'), inst, {
|
|
8393
|
-
deleteFunction: function deleteFunction(_x) {
|
|
8394
|
-
if (!_solidLogic.solidLogicSingleton.store.updater) {
|
|
8395
|
-
throw new Error('Cannot delete this, store has no updater');
|
|
8349
|
+
function deleteFunction() {
|
|
8350
|
+
return _deleteFunction.apply(this, arguments);
|
|
8396
8351
|
}
|
|
8397
8352
|
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
}
|
|
8404
|
-
});
|
|
8405
|
-
}
|
|
8406
|
-
}));
|
|
8353
|
+
return deleteFunction;
|
|
8354
|
+
}()
|
|
8355
|
+
});
|
|
8356
|
+
row.children[0].style.paddingLeft = '3em';
|
|
8357
|
+
tbody.appendChild(row);
|
|
8407
8358
|
};
|
|
8408
8359
|
|
|
8409
|
-
for (
|
|
8410
|
-
|
|
8360
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
8361
|
+
_loop();
|
|
8362
|
+
}
|
|
8363
|
+
} catch (err) {
|
|
8364
|
+
_iterator3.e(err);
|
|
8365
|
+
} finally {
|
|
8366
|
+
_iterator3.f();
|
|
8367
|
+
}
|
|
8411
8368
|
|
|
8412
|
-
|
|
8413
|
-
|
|
8369
|
+
case 28:
|
|
8370
|
+
_context9.next = 18;
|
|
8371
|
+
break;
|
|
8414
8372
|
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
fetcher.load(containers).then(function(xhrs){
|
|
8419
|
-
for (const i=0; i<containers.length; i++) {
|
|
8420
|
-
const cont = containers[i];
|
|
8421
|
-
instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
|
|
8422
|
-
}
|
|
8423
|
-
});
|
|
8424
|
-
}
|
|
8425
|
-
*/
|
|
8373
|
+
case 30:
|
|
8374
|
+
_context9.next = 35;
|
|
8375
|
+
break;
|
|
8426
8376
|
|
|
8377
|
+
case 32:
|
|
8378
|
+
_context9.prev = 32;
|
|
8379
|
+
_context9.t0 = _context9["catch"](16);
|
|
8427
8380
|
|
|
8428
|
-
|
|
8381
|
+
_iterator2.e(_context9.t0);
|
|
8429
8382
|
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
if (containers.length) {
|
|
8433
|
-
fetcher.load(containers).then(function(xhrs){
|
|
8434
|
-
for (const i=0; i<containers.length; i++) {
|
|
8435
|
-
const cont = containers[i];
|
|
8436
|
-
instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
|
|
8437
|
-
}
|
|
8438
|
-
});
|
|
8439
|
-
}
|
|
8440
|
-
*/
|
|
8441
|
-
return context;
|
|
8442
|
-
}));
|
|
8383
|
+
case 35:
|
|
8384
|
+
_context9.prev = 35;
|
|
8443
8385
|
|
|
8444
|
-
|
|
8386
|
+
_iterator2.f();
|
|
8387
|
+
|
|
8388
|
+
return _context9.finish(35);
|
|
8389
|
+
|
|
8390
|
+
case 38:
|
|
8391
|
+
return _context9.abrupt("return", context);
|
|
8392
|
+
|
|
8393
|
+
case 39:
|
|
8445
8394
|
case "end":
|
|
8446
|
-
return
|
|
8395
|
+
return _context9.stop();
|
|
8447
8396
|
}
|
|
8448
8397
|
}
|
|
8449
|
-
},
|
|
8398
|
+
}, _callee9, null, [[16, 32, 35, 38]]);
|
|
8450
8399
|
}));
|
|
8451
8400
|
return _registrationList.apply(this, arguments);
|
|
8452
8401
|
}
|
|
@@ -8455,14 +8404,14 @@ function getDefaultSignInButtonStyle() {
|
|
|
8455
8404
|
return 'padding: 1em; border-radius:0.5em; font-size: 100%;';
|
|
8456
8405
|
}
|
|
8457
8406
|
/**
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8407
|
+
* Bootstrapping identity
|
|
8408
|
+
* (Called by `loginStatusBox()`)
|
|
8409
|
+
*
|
|
8410
|
+
* @param dom
|
|
8411
|
+
* @param setUserCallback
|
|
8412
|
+
*
|
|
8413
|
+
* @returns
|
|
8414
|
+
*/
|
|
8466
8415
|
|
|
8467
8416
|
|
|
8468
8417
|
function signInOrSignUpBox(dom, setUserCallback) {
|
|
@@ -8540,8 +8489,8 @@ function signInOrSignUpBox(dom, setUserCallback) {
|
|
|
8540
8489
|
|
|
8541
8490
|
function renderSignInPopup(dom) {
|
|
8542
8491
|
/**
|
|
8543
|
-
|
|
8544
|
-
|
|
8492
|
+
* Issuer Menu
|
|
8493
|
+
*/
|
|
8545
8494
|
var issuerPopup = dom.createElement('div');
|
|
8546
8495
|
issuerPopup.setAttribute('style', 'position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center;');
|
|
8547
8496
|
dom.body.appendChild(issuerPopup);
|
|
@@ -8555,7 +8504,7 @@ function renderSignInPopup(dom) {
|
|
|
8555
8504
|
issuerPopupBoxLabel.setAttribute('style', 'margin-right: 5px; font-weight: 800');
|
|
8556
8505
|
issuerPopupBoxLabel.innerText = 'Select an identity provider';
|
|
8557
8506
|
var issuerPopupBoxCloseButton = dom.createElement('button');
|
|
8558
|
-
issuerPopupBoxCloseButton.innerHTML = '<img src="https://
|
|
8507
|
+
issuerPopupBoxCloseButton.innerHTML = '<img src="https://solidos.github.io/solid-ui/src/icons/noun_1180156.svg" style="width: 2em; height: 2em;" title="Cancel">';
|
|
8559
8508
|
issuerPopupBoxCloseButton.setAttribute('style', 'background-color: transparent; border: none;');
|
|
8560
8509
|
issuerPopupBoxCloseButton.addEventListener('click', function () {
|
|
8561
8510
|
issuerPopup.remove();
|
|
@@ -8603,13 +8552,13 @@ function renderSignInPopup(dom) {
|
|
|
8603
8552
|
}, _callee, null, [[0, 8]]);
|
|
8604
8553
|
}));
|
|
8605
8554
|
|
|
8606
|
-
return function loginToIssuer(
|
|
8555
|
+
return function loginToIssuer(_x11) {
|
|
8607
8556
|
return _ref.apply(this, arguments);
|
|
8608
8557
|
};
|
|
8609
8558
|
}();
|
|
8610
8559
|
/**
|
|
8611
|
-
|
|
8612
|
-
|
|
8560
|
+
* Text-based idp selection
|
|
8561
|
+
*/
|
|
8613
8562
|
|
|
8614
8563
|
|
|
8615
8564
|
var issuerTextContainer = dom.createElement('div');
|
|
@@ -8636,8 +8585,8 @@ function renderSignInPopup(dom) {
|
|
|
8636
8585
|
issuerTextContainer.appendChild(issuerTextInputContainer);
|
|
8637
8586
|
issuerPopupBox.appendChild(issuerTextContainer);
|
|
8638
8587
|
/**
|
|
8639
|
-
|
|
8640
|
-
|
|
8588
|
+
* Button-based idp selection
|
|
8589
|
+
*/
|
|
8641
8590
|
|
|
8642
8591
|
var issuerButtonContainer = dom.createElement('div');
|
|
8643
8592
|
issuerButtonContainer.setAttribute('style', "\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n ");
|
|
@@ -8657,15 +8606,15 @@ function renderSignInPopup(dom) {
|
|
|
8657
8606
|
issuerPopupBox.appendChild(issuerButtonContainer);
|
|
8658
8607
|
}
|
|
8659
8608
|
/**
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8609
|
+
* Login status box
|
|
8610
|
+
*
|
|
8611
|
+
* A big sign-up/sign in box or a logout box depending on the state
|
|
8612
|
+
*
|
|
8613
|
+
* @param dom
|
|
8614
|
+
* @param listener
|
|
8615
|
+
*
|
|
8616
|
+
* @returns
|
|
8617
|
+
*/
|
|
8669
8618
|
|
|
8670
8619
|
|
|
8671
8620
|
function loginStatusBox(dom) {
|
|
@@ -8826,28 +8775,28 @@ _solidLogic.authSession.onLogout( /*#__PURE__*/(0, _asyncToGenerator2["default"]
|
|
|
8826
8775
|
}, _callee2, null, [[2, 17]]);
|
|
8827
8776
|
})));
|
|
8828
8777
|
/**
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8778
|
+
* Workspace selection etc
|
|
8779
|
+
* See https://github.com/solidos/userguide/issues/16
|
|
8780
|
+
*/
|
|
8832
8781
|
|
|
8833
8782
|
/**
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8783
|
+
* Returns a UI object which, if it selects a workspace,
|
|
8784
|
+
* will callback(workspace, newBase).
|
|
8785
|
+
* See https://github.com/solidos/userguide/issues/16 for more info on workspaces.
|
|
8786
|
+
*
|
|
8787
|
+
* If necessary, will get an account, preference file, etc. In sequence:
|
|
8788
|
+
*
|
|
8789
|
+
* - If not logged in, log in.
|
|
8790
|
+
* - Load preference file
|
|
8791
|
+
* - Prompt user for workspaces
|
|
8792
|
+
* - Allows the user to just type in a URI by hand
|
|
8793
|
+
*
|
|
8794
|
+
* Calls back with the workspace and the base URI
|
|
8795
|
+
*
|
|
8796
|
+
* @param dom
|
|
8797
|
+
* @param appDetails
|
|
8798
|
+
* @param callbackWS
|
|
8799
|
+
*/
|
|
8851
8800
|
|
|
8852
8801
|
|
|
8853
8802
|
function selectWorkspace(dom, appDetails, callbackWS) {
|
|
@@ -8890,7 +8839,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
|
|
|
8890
8839
|
|
|
8891
8840
|
function displayOptions(context) {
|
|
8892
8841
|
// console.log('displayOptions!', context)
|
|
8893
|
-
function makeNewWorkspace(
|
|
8842
|
+
function makeNewWorkspace(_x12) {
|
|
8894
8843
|
return _makeNewWorkspace.apply(this, arguments);
|
|
8895
8844
|
} // const status = ''
|
|
8896
8845
|
|
|
@@ -9110,21 +9059,21 @@ function selectWorkspace(dom, appDetails, callbackWS) {
|
|
|
9110
9059
|
} // selectWorkspace
|
|
9111
9060
|
|
|
9112
9061
|
/**
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9062
|
+
* Creates a new instance of an app.
|
|
9063
|
+
*
|
|
9064
|
+
* An instance of an app could be e.g. an issue tracker for a given project,
|
|
9065
|
+
* or a chess game, or calendar, or a health/fitness record for a person.
|
|
9066
|
+
*
|
|
9067
|
+
* Note that this use of the term 'app' refers more to entries in the user's
|
|
9068
|
+
* type index than to actual software applications that use the personal data
|
|
9069
|
+
* to which these entries point.
|
|
9070
|
+
*
|
|
9071
|
+
* @param dom
|
|
9072
|
+
* @param appDetails
|
|
9073
|
+
* @param callback
|
|
9074
|
+
*
|
|
9075
|
+
* @returns A div with a button in it for making a new app instance
|
|
9076
|
+
*/
|
|
9128
9077
|
|
|
9129
9078
|
|
|
9130
9079
|
function newAppInstance(dom, appDetails, callback) {
|
|
@@ -9159,77 +9108,77 @@ function getUserRoles() {
|
|
|
9159
9108
|
|
|
9160
9109
|
|
|
9161
9110
|
function _getUserRoles() {
|
|
9162
|
-
_getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
9111
|
+
_getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
9163
9112
|
var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
|
|
9164
9113
|
|
|
9165
|
-
return _regenerator["default"].wrap(function
|
|
9114
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
9166
9115
|
while (1) {
|
|
9167
|
-
switch (
|
|
9116
|
+
switch (_context10.prev = _context10.next) {
|
|
9168
9117
|
case 0:
|
|
9169
|
-
|
|
9170
|
-
|
|
9118
|
+
_context10.prev = 0;
|
|
9119
|
+
_context10.next = 3;
|
|
9171
9120
|
return ensureLoadedPreferences({});
|
|
9172
9121
|
|
|
9173
9122
|
case 3:
|
|
9174
|
-
_yield$ensureLoadedPr =
|
|
9123
|
+
_yield$ensureLoadedPr = _context10.sent;
|
|
9175
9124
|
me = _yield$ensureLoadedPr.me;
|
|
9176
9125
|
preferencesFile = _yield$ensureLoadedPr.preferencesFile;
|
|
9177
9126
|
preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
|
|
9178
9127
|
|
|
9179
9128
|
if (!(!preferencesFile || preferencesFileError)) {
|
|
9180
|
-
|
|
9129
|
+
_context10.next = 9;
|
|
9181
9130
|
break;
|
|
9182
9131
|
}
|
|
9183
9132
|
|
|
9184
9133
|
throw new Error(preferencesFileError);
|
|
9185
9134
|
|
|
9186
9135
|
case 9:
|
|
9187
|
-
return
|
|
9136
|
+
return _context10.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
|
|
9188
9137
|
|
|
9189
9138
|
case 12:
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
debug.warn('Unable to fetch your preferences - this was the error: ',
|
|
9139
|
+
_context10.prev = 12;
|
|
9140
|
+
_context10.t0 = _context10["catch"](0);
|
|
9141
|
+
debug.warn('Unable to fetch your preferences - this was the error: ', _context10.t0);
|
|
9193
9142
|
|
|
9194
9143
|
case 15:
|
|
9195
|
-
return
|
|
9144
|
+
return _context10.abrupt("return", []);
|
|
9196
9145
|
|
|
9197
9146
|
case 16:
|
|
9198
9147
|
case "end":
|
|
9199
|
-
return
|
|
9148
|
+
return _context10.stop();
|
|
9200
9149
|
}
|
|
9201
9150
|
}
|
|
9202
|
-
},
|
|
9151
|
+
}, _callee10, null, [[0, 12]]);
|
|
9203
9152
|
}));
|
|
9204
9153
|
return _getUserRoles.apply(this, arguments);
|
|
9205
9154
|
}
|
|
9206
9155
|
|
|
9207
|
-
function filterAvailablePanes(
|
|
9156
|
+
function filterAvailablePanes(_x13) {
|
|
9208
9157
|
return _filterAvailablePanes.apply(this, arguments);
|
|
9209
9158
|
}
|
|
9210
9159
|
|
|
9211
9160
|
function _filterAvailablePanes() {
|
|
9212
|
-
_filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
9161
|
+
_filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(panes) {
|
|
9213
9162
|
var userRoles;
|
|
9214
|
-
return _regenerator["default"].wrap(function
|
|
9163
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
9215
9164
|
while (1) {
|
|
9216
|
-
switch (
|
|
9165
|
+
switch (_context11.prev = _context11.next) {
|
|
9217
9166
|
case 0:
|
|
9218
|
-
|
|
9167
|
+
_context11.next = 2;
|
|
9219
9168
|
return getUserRoles();
|
|
9220
9169
|
|
|
9221
9170
|
case 2:
|
|
9222
|
-
userRoles =
|
|
9223
|
-
return
|
|
9171
|
+
userRoles = _context11.sent;
|
|
9172
|
+
return _context11.abrupt("return", panes.filter(function (pane) {
|
|
9224
9173
|
return isMatchingAudience(pane, userRoles);
|
|
9225
9174
|
}));
|
|
9226
9175
|
|
|
9227
9176
|
case 4:
|
|
9228
9177
|
case "end":
|
|
9229
|
-
return
|
|
9178
|
+
return _context11.stop();
|
|
9230
9179
|
}
|
|
9231
9180
|
}
|
|
9232
|
-
},
|
|
9181
|
+
}, _callee11);
|
|
9233
9182
|
}));
|
|
9234
9183
|
return _filterAvailablePanes.apply(this, arguments);
|
|
9235
9184
|
}
|
|
@@ -11405,7 +11354,7 @@ function participationObject(subject, padDoc, me) {
|
|
|
11405
11354
|
});
|
|
11406
11355
|
|
|
11407
11356
|
if (parps.length > 1) {
|
|
11408
|
-
// This can happen. https://github.com/
|
|
11357
|
+
// This can happen. https://github.com/solidos/chat-pane/issues/71
|
|
11409
11358
|
var candidates = [];
|
|
11410
11359
|
|
|
11411
11360
|
var _iterator = _createForOfIteratorHelper(parps),
|
|
@@ -12024,6 +11973,83 @@ module.exports = style; // @@ No way to do this in ESM
|
|
|
12024
11973
|
|
|
12025
11974
|
/***/ }),
|
|
12026
11975
|
|
|
11976
|
+
/***/ "./lib/style_multiSelect.js":
|
|
11977
|
+
/*!**********************************!*\
|
|
11978
|
+
!*** ./lib/style_multiSelect.js ***!
|
|
11979
|
+
\**********************************/
|
|
11980
|
+
/***/ ((module, exports) => {
|
|
11981
|
+
|
|
11982
|
+
"use strict";
|
|
11983
|
+
|
|
11984
|
+
|
|
11985
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
11986
|
+
value: true
|
|
11987
|
+
}));
|
|
11988
|
+
exports.style = void 0;
|
|
11989
|
+
|
|
11990
|
+
/*
|
|
11991
|
+
* BASED ON:
|
|
11992
|
+
* IconicMultiSelect v0.7.0
|
|
11993
|
+
* Licence: MIT
|
|
11994
|
+
* (c) 2021 Sidney Wimart.
|
|
11995
|
+
* repo & configuration: https://github.com/sidneywm/iconic-multiselect
|
|
11996
|
+
*/
|
|
11997
|
+
|
|
11998
|
+
/**
|
|
11999
|
+
* @version IconicMultiSelect v0.7.0
|
|
12000
|
+
* @licence MIT
|
|
12001
|
+
*/
|
|
12002
|
+
var style = {
|
|
12003
|
+
multiselect__container: "\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n background-color: #fff;\n border-radius: 2px;\n -webkit-box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n min-height: 36px;\n padding: 4px 8px 0 8px;\n position: relative;\n width: 354px;\n margin-bottom: 5px;\n font-size: 100%\n ",
|
|
12004
|
+
|
|
12005
|
+
/*
|
|
12006
|
+
multiselect__container:after: `
|
|
12007
|
+
content: '';
|
|
12008
|
+
min-height:inherit;
|
|
12009
|
+
font-size:0;
|
|
12010
|
+
`,
|
|
12011
|
+
multiselect__container > *: `
|
|
12012
|
+
color: #656565;
|
|
12013
|
+
font-size: 14px;
|
|
12014
|
+
`,
|
|
12015
|
+
*/
|
|
12016
|
+
multiselect__wrapper: "\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n height: 100%;\n width: 100%;\n ",
|
|
12017
|
+
multiselect__clear_btn: "\n cursor: pointer;\n align-items: center;\n margin-bottom: 4px;\n margin-left: 4px;\n ",
|
|
12018
|
+
multiselect__options: "\n background-color: #f6f6f6;\n border-radius: 2px;\n left: 0;\n max-height: 0;\n overflow: hidden;\n position: absolute;\n top: calc(100% + 3px);\n z-index: 9999;\n width: 100%;\n opacity: 0;\n transition: max-height 0.1s ease;\n ",
|
|
12019
|
+
multiselect__options_visible: "\n background-color: #f6f6f6;\n border-radius: 2px;\n left: 0;\n max-height: 0;\n overflow: hidden;\n position: absolute;\n top: calc(100% + 3px);\n z-index: 9999;\n width: 100%;\n opacity: 0;\n transition: max-height 0.1s ease;\n max-height: 200px;\n -webkit-box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n opacity: 1;\n transition: max-height 0.2s ease;\n ",
|
|
12020
|
+
multiselect__options_ul: "\n list-style: none;\n margin: 0;\n padding: 2px 0;\n max-height: 200px;\n overflow: auto;\n ",
|
|
12021
|
+
multiselect__options_ul_li: "\n cursor: pointer;\n padding: 4px 8px;\n ",
|
|
12022
|
+
// multiselect__options ul li:hover: `
|
|
12023
|
+
multiselect__options_ul_li_hover: "\n background-color: #dedede;\n ",
|
|
12024
|
+
|
|
12025
|
+
/*
|
|
12026
|
+
multiselect__options ul li *: `
|
|
12027
|
+
pointer-events: none;
|
|
12028
|
+
`,
|
|
12029
|
+
*/
|
|
12030
|
+
multiselect__options_ul_p_multiselect__options_no_results: "\n margin: 0;\n padding: 8px;\n text-align: center;\n ",
|
|
12031
|
+
multiselect__options_ul_p_multiselect__options_no_data: "\n margin: 0;\n padding: 8px;\n text-align: center;\n ",
|
|
12032
|
+
// multiselect__options ul li.multiselect__options--selected: `
|
|
12033
|
+
multiselect__options_ul_li_multiselect__options_selected: "\n background-color: #656565;\n color: #fff;\n ",
|
|
12034
|
+
// multiselect__options ul li.multiselect__options--selected:hover: `
|
|
12035
|
+
multiselect__options_ul_li_multiselect__options_selected_hover: "\n background-color: #656565;\n ",
|
|
12036
|
+
// multiselect__options ul li.arrow-selected: `
|
|
12037
|
+
multiselect__options_ul_li_arrow_selected: "\n border: 2px solid rgba(101, 101, 101, 0.5);\n ",
|
|
12038
|
+
multiselect__selected: "\n background-color: #656565;\n border-radius: 2px;\n color: #fff;\n margin-bottom: 4px;\n margin-right: 4px;\n padding: 4px 8px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n ",
|
|
12039
|
+
multiselect__selected_multiselect__remove_btn: "\n cursor: pointer;\n display: flex;\n margin-left: 6px;\n ",
|
|
12040
|
+
multiselect__input: "\n border: none;\n -ms-flex-preferred-size: 40%;\n flex-basis: 40%;\n -webkit-box-flex: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n height: 5px; \n margin-bottom: 4px;\n min-width: 40%;\n outline: none; \n "
|
|
12041
|
+
};
|
|
12042
|
+
exports.style = style;
|
|
12043
|
+
|
|
12044
|
+
style.setStyle = function setStyle(ele, styleName) {
|
|
12045
|
+
ele.style = style[styleName];
|
|
12046
|
+
};
|
|
12047
|
+
|
|
12048
|
+
module.exports = style;
|
|
12049
|
+
//# sourceMappingURL=style_multiSelect.js.map
|
|
12050
|
+
|
|
12051
|
+
/***/ }),
|
|
12052
|
+
|
|
12027
12053
|
/***/ "./lib/table.js":
|
|
12028
12054
|
/*!**********************!*\
|
|
12029
12055
|
!*** ./lib/table.js ***!
|
|
@@ -13750,7 +13776,7 @@ var TabElement = /*#__PURE__*/function (_HTMLElement3) {
|
|
|
13750
13776
|
/**
|
|
13751
13777
|
* Use this widget to generate tabs from triples set in the global store.
|
|
13752
13778
|
*
|
|
13753
|
-
* [Here you can see examples of the tabs](https://
|
|
13779
|
+
* [Here you can see examples of the tabs](https://solidos.github.io/solid-ui/examples/tabs/).
|
|
13754
13780
|
*
|
|
13755
13781
|
* It assumes that items to use for tabs will be in a collection by default,
|
|
13756
13782
|
* e.g.:
|
|
@@ -13912,9 +13938,9 @@ function tabWidget(options) {
|
|
|
13912
13938
|
var marginsPrepped = margins.concat(margins).slice(orientation, orientation + 4);
|
|
13913
13939
|
var marginsStyle = "margin: ".concat(marginsPrepped.join(' '), ";");
|
|
13914
13940
|
var paddingStyle = "padding: ".concat(marginsPrepped.join(' '), ";");
|
|
13915
|
-
var tabStyle = cornersStyle + "padding: 0.7em; max-width: 20em; color: ".concat(color, ";");
|
|
13916
|
-
var unselectedStyle = "".concat(tabStyle + marginsStyle, "opacity: 50%; background-color: ").concat(backgroundColor, ";");
|
|
13917
|
-
var selectedStyle = "".concat(tabStyle + marginsStyle, "background-color: ").concat(selectedColor, ";");
|
|
13941
|
+
var tabStyle = cornersStyle + "position: relative; padding: 0.7em; max-width: 20em; color: ".concat(color, ";");
|
|
13942
|
+
var unselectedStyle = "".concat(tabStyle + marginsStyle, " opacity: 50%; background-color: ").concat(backgroundColor, ";");
|
|
13943
|
+
var selectedStyle = "".concat(tabStyle + marginsStyle, " background-color: ").concat(selectedColor, ";");
|
|
13918
13944
|
var shownStyle = 'height: 100%; width: 100%;';
|
|
13919
13945
|
var hiddenStyle = shownStyle + 'display: none;';
|
|
13920
13946
|
rootElement.refresh = orderedSync;
|
|
@@ -13930,7 +13956,9 @@ function tabWidget(options) {
|
|
|
13930
13956
|
var selectedTabURI = options.selectedTab.uri;
|
|
13931
13957
|
var selectedTab1 = Array.from(tabContainer.children) // @ts-ignore
|
|
13932
13958
|
.find(function (tab) {
|
|
13933
|
-
return tab.subject &&
|
|
13959
|
+
return tab.subject && // @ts-ignore
|
|
13960
|
+
tab.subject.uri && // @ts-ignore
|
|
13961
|
+
tab.subject.uri === selectedTabURI;
|
|
13934
13962
|
});
|
|
13935
13963
|
var tab = selectedTab1 || selectedTab0 || tabContainer.children[0];
|
|
13936
13964
|
var clickMe = tab.firstChild; // @ts-ignore
|
|
@@ -13945,7 +13973,7 @@ function tabWidget(options) {
|
|
|
13945
13973
|
function addCancelButton(tabContainer) {
|
|
13946
13974
|
if (tabContainer.dataset.onCloseSet) {
|
|
13947
13975
|
// @@ TODO: this is only here to make the browser tests work
|
|
13948
|
-
// Discussion at https://github.com/
|
|
13976
|
+
// Discussion at https://github.com/solidos/solid-ui/pull/110#issuecomment-527080663
|
|
13949
13977
|
var existingCancelButton = tabContainer.querySelector('.unstyled');
|
|
13950
13978
|
tabContainer.removeChild(existingCancelButton);
|
|
13951
13979
|
}
|
|
@@ -13972,35 +14000,50 @@ function tabWidget(options) {
|
|
|
13972
14000
|
|
|
13973
14001
|
function makeNewSlot(item) {
|
|
13974
14002
|
var ele = dom.createElement(tabElement);
|
|
14003
|
+
ele.setAttribute('style', unselectedStyle);
|
|
13975
14004
|
ele.subject = item;
|
|
13976
|
-
var div = ele.appendChild(dom.createElement('
|
|
13977
|
-
div.setAttribute('style',
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
13981
|
-
|
|
14005
|
+
var div = ele.appendChild(dom.createElement('button'));
|
|
14006
|
+
div.setAttribute('style', 'background: none; border: none; font: inherit; cursor: pointer');
|
|
14007
|
+
var ellipsis = dom.createElement('button');
|
|
14008
|
+
ellipsis.textContent = '...';
|
|
14009
|
+
ellipsis.setAttribute('style', 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;');
|
|
14010
|
+
|
|
14011
|
+
div.onclick = function () {
|
|
14012
|
+
resetTabStyle();
|
|
14013
|
+
resetBodyStyle();
|
|
14014
|
+
ele.setAttribute('style', selectedStyle);
|
|
14015
|
+
if (!ele.bodyTR) return;
|
|
14016
|
+
ele.bodyTR.setAttribute('style', shownStyle);
|
|
14017
|
+
var bodyMain = getOrCreateContainerElement(ele);
|
|
14018
|
+
|
|
14019
|
+
if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {
|
|
14020
|
+
bodyMain.innerHTML = 'loading item ...' + item;
|
|
14021
|
+
options.renderMain(bodyMain, ele.subject);
|
|
14022
|
+
bodyMain.asSettings = false;
|
|
13982
14023
|
}
|
|
14024
|
+
};
|
|
13983
14025
|
|
|
13984
|
-
|
|
14026
|
+
ellipsis.onclick = function () {
|
|
14027
|
+
resetTabStyle();
|
|
14028
|
+
resetBodyStyle();
|
|
14029
|
+
ele.setAttribute('style', selectedStyle);
|
|
13985
14030
|
if (!ele.bodyTR) return;
|
|
13986
14031
|
ele.bodyTR.setAttribute('style', shownStyle);
|
|
13987
14032
|
var bodyMain = getOrCreateContainerElement(ele);
|
|
13988
14033
|
|
|
13989
|
-
if (options.renderTabSettings &&
|
|
14034
|
+
if (options.renderTabSettings && ele.subject && bodyMain.asSettings !== true) {
|
|
13990
14035
|
bodyMain.innerHTML = 'loading settings ...' + item;
|
|
13991
14036
|
options.renderTabSettings(bodyMain, ele.subject);
|
|
13992
14037
|
bodyMain.asSettings = true;
|
|
13993
|
-
} else if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {
|
|
13994
|
-
bodyMain.innerHTML = 'loading item ...' + item;
|
|
13995
|
-
options.renderMain(bodyMain, ele.subject);
|
|
13996
|
-
bodyMain.asSettings = false;
|
|
13997
14038
|
}
|
|
13998
|
-
}
|
|
14039
|
+
};
|
|
13999
14040
|
|
|
14000
14041
|
if (options.renderTab) {
|
|
14001
14042
|
options.renderTab(div, item);
|
|
14043
|
+
ele.appendChild(ellipsis);
|
|
14002
14044
|
} else {
|
|
14003
|
-
div.
|
|
14045
|
+
div.innerHTML = (0, _utils.label)(item);
|
|
14046
|
+
ele.appendChild(ellipsis);
|
|
14004
14047
|
}
|
|
14005
14048
|
|
|
14006
14049
|
return ele;
|
|
@@ -14080,10 +14123,8 @@ function tabWidget(options) {
|
|
|
14080
14123
|
|
|
14081
14124
|
if (_tab.classList.contains('unstyled')) {
|
|
14082
14125
|
continue;
|
|
14083
|
-
}
|
|
14084
|
-
|
|
14085
|
-
if (_tab.children[0]) {
|
|
14086
|
-
_tab.children[0].setAttribute('style', unselectedStyle);
|
|
14126
|
+
} else {
|
|
14127
|
+
_tab.setAttribute('style', unselectedStyle);
|
|
14087
14128
|
}
|
|
14088
14129
|
}
|
|
14089
14130
|
}
|
|
@@ -14281,63 +14322,68 @@ function _getPodOwner() {
|
|
|
14281
14322
|
podOwner = store.any(pod, _.ns.solid('owner'), null, pod) || store.any(null, _.ns.space('storage'), pod, pod);
|
|
14282
14323
|
|
|
14283
14324
|
if (!podOwner) {
|
|
14284
|
-
_context.next =
|
|
14325
|
+
_context.next = 31;
|
|
14285
14326
|
break;
|
|
14286
14327
|
}
|
|
14287
14328
|
|
|
14288
14329
|
_context.prev = 18;
|
|
14289
|
-
|
|
14290
|
-
|
|
14330
|
+
_context.next = 21;
|
|
14331
|
+
return store.fetcher.load(podOwner.doc());
|
|
14332
|
+
|
|
14333
|
+
case 21:
|
|
14334
|
+
_context.next = 27;
|
|
14291
14335
|
break;
|
|
14292
14336
|
|
|
14293
|
-
case
|
|
14294
|
-
_context.prev =
|
|
14337
|
+
case 23:
|
|
14338
|
+
_context.prev = 23;
|
|
14295
14339
|
_context.t1 = _context["catch"](18);
|
|
14296
14340
|
console.warn('Unable to load profile of pod owner ' + podOwner);
|
|
14297
14341
|
return _context.abrupt("return", null);
|
|
14298
14342
|
|
|
14299
|
-
case
|
|
14343
|
+
case 27:
|
|
14300
14344
|
if (!store.holds(podOwner, _.ns.space('storage'), pod, podOwner.doc())) {
|
|
14301
14345
|
console.warn("Pod owner ".concat(podOwner, " does NOT list pod ").concat(pod, " as their storage"));
|
|
14302
14346
|
}
|
|
14303
14347
|
|
|
14304
14348
|
return _context.abrupt("return", podOwner);
|
|
14305
14349
|
|
|
14306
|
-
case
|
|
14350
|
+
case 31:
|
|
14307
14351
|
// pod owner not declared in pod
|
|
14308
14352
|
// @@ TODO: This is given the structure that NSS provides
|
|
14309
14353
|
// This is a massive guess. For old pods which don't have owner link
|
|
14310
14354
|
guess = (0, _rdflib.sym)("".concat(pod.uri, "profile/card#me"));
|
|
14311
|
-
_context.prev =
|
|
14312
|
-
|
|
14313
|
-
store.fetcher.load(guess);
|
|
14314
|
-
_context.next = 39;
|
|
14315
|
-
break;
|
|
14355
|
+
_context.prev = 32;
|
|
14356
|
+
_context.next = 35;
|
|
14357
|
+
return store.fetcher.load(guess);
|
|
14316
14358
|
|
|
14317
14359
|
case 35:
|
|
14318
|
-
_context.
|
|
14319
|
-
|
|
14360
|
+
_context.next = 41;
|
|
14361
|
+
break;
|
|
14362
|
+
|
|
14363
|
+
case 37:
|
|
14364
|
+
_context.prev = 37;
|
|
14365
|
+
_context.t2 = _context["catch"](32);
|
|
14320
14366
|
console.error('Ooops. Guessed wrong pod owner webid {$guess} : can\'t load it.');
|
|
14321
14367
|
return _context.abrupt("return", null);
|
|
14322
14368
|
|
|
14323
|
-
case
|
|
14369
|
+
case 41:
|
|
14324
14370
|
if (!store.holds(guess, _.ns.space('storage'), pod, guess.doc())) {
|
|
14325
|
-
_context.next =
|
|
14371
|
+
_context.next = 44;
|
|
14326
14372
|
break;
|
|
14327
14373
|
}
|
|
14328
14374
|
|
|
14329
14375
|
console.warn('Using guessed pod owner webid but it links back.');
|
|
14330
14376
|
return _context.abrupt("return", guess);
|
|
14331
14377
|
|
|
14332
|
-
case
|
|
14378
|
+
case 44:
|
|
14333
14379
|
return _context.abrupt("return", null);
|
|
14334
14380
|
|
|
14335
|
-
case
|
|
14381
|
+
case 45:
|
|
14336
14382
|
case "end":
|
|
14337
14383
|
return _context.stop();
|
|
14338
14384
|
}
|
|
14339
14385
|
}
|
|
14340
|
-
}, _callee, null, [[0, 9], [18,
|
|
14386
|
+
}, _callee, null, [[0, 9], [18, 23], [32, 37]]);
|
|
14341
14387
|
}));
|
|
14342
14388
|
return _getPodOwner.apply(this, arguments);
|
|
14343
14389
|
}
|
|
@@ -15163,7 +15209,7 @@ function slice(s, suffix) {
|
|
|
15163
15209
|
|
|
15164
15210
|
function getWellKnownLabel(thing) {
|
|
15165
15211
|
return _solidLogic.store.any(thing, UI.ns.ui('label')) || // Prioritize ui:label
|
|
15166
|
-
_solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label'));
|
|
15212
|
+
_solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2004/02/skos/core#prefLabel'));
|
|
15167
15213
|
}
|
|
15168
15214
|
//# sourceMappingURL=label.js.map
|
|
15169
15215
|
|
|
@@ -15183,11 +15229,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
15183
15229
|
}));
|
|
15184
15230
|
exports.versionInfo = void 0;
|
|
15185
15231
|
var versionInfo = {
|
|
15186
|
-
buildTime: '2022-
|
|
15187
|
-
commit: '
|
|
15232
|
+
buildTime: '2022-06-14T09:29:49Z',
|
|
15233
|
+
commit: '027fc53ec9891c526b2c97f308a2f570faa0ea07',
|
|
15188
15234
|
npmInfo: {
|
|
15189
|
-
'solid-ui': '2.4.
|
|
15190
|
-
npm: '6.14.
|
|
15235
|
+
'solid-ui': '2.4.22',
|
|
15236
|
+
npm: '6.14.17',
|
|
15191
15237
|
ares: '1.18.1',
|
|
15192
15238
|
brotli: '1.0.9',
|
|
15193
15239
|
cldr: '40.0',
|
|
@@ -15196,12 +15242,12 @@ var versionInfo = {
|
|
|
15196
15242
|
modules: '83',
|
|
15197
15243
|
napi: '8',
|
|
15198
15244
|
nghttp2: '1.42.0',
|
|
15199
|
-
node: '14.19.
|
|
15200
|
-
openssl: '1.1.
|
|
15245
|
+
node: '14.19.3',
|
|
15246
|
+
openssl: '1.1.1o',
|
|
15201
15247
|
tz: '2021a3',
|
|
15202
15248
|
unicode: '14.0',
|
|
15203
15249
|
uv: '1.42.0',
|
|
15204
|
-
v8: '8.4.371.23-node.
|
|
15250
|
+
v8: '8.4.371.23-node.87',
|
|
15205
15251
|
zlib: '1.2.11'
|
|
15206
15252
|
}
|
|
15207
15253
|
};
|
|
@@ -16271,6 +16317,7 @@ function openHrefInOutlineMode(e) {
|
|
|
16271
16317
|
|
|
16272
16318
|
if (dom.outlineManager) {
|
|
16273
16319
|
// @@ TODO Remove the use of document as a global object
|
|
16320
|
+
// TODO fix dependency cycle to solid-panes by calling outlineManager
|
|
16274
16321
|
;
|
|
16275
16322
|
dom.outlineManager.GotoSubject(_solidLogic.store.sym(uri), true, undefined, true, undefined);
|
|
16276
16323
|
} else if (window && window.panes && window.panes.getOutliner) {
|
|
@@ -16398,6 +16445,7 @@ function linkButton(dom, object) {
|
|
|
16398
16445
|
b.textContent = 'Goto ' + utils.label(object);
|
|
16399
16446
|
b.addEventListener('click', function (_event) {
|
|
16400
16447
|
// b.parentNode.removeChild(b)
|
|
16448
|
+
// TODO fix dependency cycle to solid-panes by calling outlineManager
|
|
16401
16449
|
;
|
|
16402
16450
|
dom.outlineManager.GotoSubject(object, true, undefined, true, undefined);
|
|
16403
16451
|
}, true);
|
|
@@ -17038,7 +17086,7 @@ function uploadFiles(fetcher, files, fileBase, imageBase, successHandler) {
|
|
|
17038
17086
|
/*!******************************!*\
|
|
17039
17087
|
!*** ./lib/widgets/error.js ***!
|
|
17040
17088
|
\******************************/
|
|
17041
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
17089
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
17042
17090
|
|
|
17043
17091
|
"use strict";
|
|
17044
17092
|
|
|
@@ -17048,6 +17096,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
17048
17096
|
}));
|
|
17049
17097
|
exports.errorMessageBlock = errorMessageBlock;
|
|
17050
17098
|
|
|
17099
|
+
var _widgets = __webpack_require__(/*! ../widgets */ "./lib/widgets/index.js");
|
|
17100
|
+
|
|
17051
17101
|
/**
|
|
17052
17102
|
* Create an error message block
|
|
17053
17103
|
* @param dom The DOM on which dom.createElement will be called
|
|
@@ -17078,6 +17128,9 @@ function errorMessageBlock(dom, err, backgroundColor, err2) {
|
|
|
17078
17128
|
div.textContent = err;
|
|
17079
17129
|
}
|
|
17080
17130
|
|
|
17131
|
+
div.appendChild((0, _widgets.cancelButton)(dom, function () {
|
|
17132
|
+
if (div.parentNode) div.parentNode.removeChild(div);
|
|
17133
|
+
})).style = 'width: 2em; height: 2em; align: right;';
|
|
17081
17134
|
div.setAttribute('style', 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; background-color: ' + (backgroundColor || '#fee') + '; color:black;');
|
|
17082
17135
|
return div;
|
|
17083
17136
|
}
|
|
@@ -17116,6 +17169,12 @@ Object.defineProperty(exports, "field", ({
|
|
|
17116
17169
|
return _fieldFunction.field;
|
|
17117
17170
|
}
|
|
17118
17171
|
}));
|
|
17172
|
+
Object.defineProperty(exports, "fieldFunction", ({
|
|
17173
|
+
enumerable: true,
|
|
17174
|
+
get: function get() {
|
|
17175
|
+
return _fieldFunction.fieldFunction;
|
|
17176
|
+
}
|
|
17177
|
+
}));
|
|
17119
17178
|
Object.defineProperty(exports, "fieldLabel", ({
|
|
17120
17179
|
enumerable: true,
|
|
17121
17180
|
get: function get() {
|
|
@@ -17138,8 +17197,15 @@ exports.findClosest = findClosest;
|
|
|
17138
17197
|
exports.formsFor = formsFor;
|
|
17139
17198
|
exports.makeDescription = makeDescription;
|
|
17140
17199
|
exports.makeSelectForCategory = makeSelectForCategory;
|
|
17200
|
+
exports.makeSelectForChoice = makeSelectForChoice;
|
|
17141
17201
|
exports.makeSelectForNestedCategory = makeSelectForNestedCategory;
|
|
17142
17202
|
exports.makeSelectForOptions = makeSelectForOptions;
|
|
17203
|
+
Object.defineProperty(exports, "mostSpecificClassURI", ({
|
|
17204
|
+
enumerable: true,
|
|
17205
|
+
get: function get() {
|
|
17206
|
+
return _fieldFunction.mostSpecificClassURI;
|
|
17207
|
+
}
|
|
17208
|
+
}));
|
|
17143
17209
|
exports.newButton = newButton;
|
|
17144
17210
|
exports.newThing = newThing;
|
|
17145
17211
|
exports.promptForNew = promptForNew;
|
|
@@ -17187,6 +17253,8 @@ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-l
|
|
|
17187
17253
|
|
|
17188
17254
|
var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
|
|
17189
17255
|
|
|
17256
|
+
var _multiSelect = __webpack_require__(/*! ./multiSelect */ "./lib/widgets/multiSelect.js");
|
|
17257
|
+
|
|
17190
17258
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
17191
17259
|
|
|
17192
17260
|
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); }
|
|
@@ -17249,14 +17317,16 @@ _fieldFunction.field[ns.ui('Form').uri] = _fieldFunction.field[ns.ui('Group').ur
|
|
|
17249
17317
|
var ui = ns.ui;
|
|
17250
17318
|
if (container) container.appendChild(box); // Prevent loops
|
|
17251
17319
|
|
|
17320
|
+
if (!form) return;
|
|
17252
17321
|
var key = subject.toNT() + '|' + form.toNT();
|
|
17253
17322
|
|
|
17254
17323
|
if (already[key]) {
|
|
17255
17324
|
// been there done that
|
|
17256
|
-
box.appendChild(dom.createTextNode('Group: see above ' + key));
|
|
17257
|
-
|
|
17325
|
+
box.appendChild(dom.createTextNode('Group: see above ' + key)); // TODO fix dependency cycle to solid-panes by calling outlineManager
|
|
17326
|
+
// const plist = [$rdf.st(subject, ns.owl('sameAs'), subject)] // @@ need prev subject
|
|
17327
|
+
// dom.outlineManager.appendPropertyTRs(box, plist)
|
|
17328
|
+
// dom.appendChild(plist)
|
|
17258
17329
|
|
|
17259
|
-
dom.outlineManager.appendPropertyTRs(box, plist);
|
|
17260
17330
|
return box;
|
|
17261
17331
|
}
|
|
17262
17332
|
|
|
@@ -17357,47 +17427,43 @@ _fieldFunction.field[ns.ui('Options').uri] = function (dom, container, already,
|
|
|
17357
17427
|
values = kb.each(subject, dependingOn);
|
|
17358
17428
|
}
|
|
17359
17429
|
|
|
17360
|
-
|
|
17361
|
-
|
|
17362
|
-
|
|
17363
|
-
for (var i = 0; i < cases.length; i++) {
|
|
17364
|
-
var c = cases[i];
|
|
17365
|
-
var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
|
|
17430
|
+
for (var i = 0; i < cases.length; i++) {
|
|
17431
|
+
var c = cases[i];
|
|
17432
|
+
var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
|
|
17366
17433
|
|
|
17367
|
-
|
|
17434
|
+
var match = false;
|
|
17368
17435
|
|
|
17369
|
-
|
|
17370
|
-
|
|
17371
|
-
|
|
17436
|
+
for (var j = 0; j < tests.length; j++) {
|
|
17437
|
+
var _iterator = _createForOfIteratorHelper(values),
|
|
17438
|
+
_step;
|
|
17372
17439
|
|
|
17373
|
-
|
|
17374
|
-
|
|
17375
|
-
|
|
17376
|
-
|
|
17440
|
+
try {
|
|
17441
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
17442
|
+
var value = _step.value;
|
|
17443
|
+
var test = tests[j];
|
|
17377
17444
|
|
|
17378
|
-
|
|
17379
|
-
|
|
17380
|
-
}
|
|
17445
|
+
if (value.sameTerm(tests) || value.termType === test.termType && value.value === test.value) {
|
|
17446
|
+
match = true;
|
|
17381
17447
|
}
|
|
17382
|
-
} catch (err) {
|
|
17383
|
-
_iterator.e(err);
|
|
17384
|
-
} finally {
|
|
17385
|
-
_iterator.f();
|
|
17386
17448
|
}
|
|
17449
|
+
} catch (err) {
|
|
17450
|
+
_iterator.e(err);
|
|
17451
|
+
} finally {
|
|
17452
|
+
_iterator.f();
|
|
17387
17453
|
}
|
|
17454
|
+
}
|
|
17388
17455
|
|
|
17389
|
-
|
|
17390
|
-
|
|
17391
|
-
|
|
17392
|
-
if (!_field3) {
|
|
17393
|
-
box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
|
|
17394
|
-
return box;
|
|
17395
|
-
} else {
|
|
17396
|
-
appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
|
|
17397
|
-
}
|
|
17456
|
+
if (match) {
|
|
17457
|
+
var _field3 = kb.the(c, ui('use'));
|
|
17398
17458
|
|
|
17399
|
-
|
|
17459
|
+
if (!_field3) {
|
|
17460
|
+
box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
|
|
17461
|
+
return box;
|
|
17462
|
+
} else {
|
|
17463
|
+
appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
|
|
17400
17464
|
}
|
|
17465
|
+
|
|
17466
|
+
break;
|
|
17401
17467
|
}
|
|
17402
17468
|
} // @@ Add box.refresh() to sync fields with values
|
|
17403
17469
|
|
|
@@ -17685,7 +17751,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
17685
17751
|
// delete button and move buttons
|
|
17686
17752
|
|
|
17687
17753
|
if (kb.updater.editable(dataDoc.uri)) {
|
|
17688
|
-
buttons.deleteButtonWithCheck(dom, subField,
|
|
17754
|
+
buttons.deleteButtonWithCheck(dom, subField, multipleUIlabel, deleteThisItem);
|
|
17689
17755
|
|
|
17690
17756
|
if (ordered) {
|
|
17691
17757
|
// Add controsl in a frame
|
|
@@ -17736,7 +17802,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
17736
17802
|
|
|
17737
17803
|
var _shim = dom.createElement('div');
|
|
17738
17804
|
|
|
17739
|
-
_shim.appendChild(subField); // Subfield has its own
|
|
17805
|
+
_shim.appendChild(subField); // Subfield has its own layout
|
|
17740
17806
|
|
|
17741
17807
|
|
|
17742
17808
|
frame.appendChild(_shim);
|
|
@@ -17785,6 +17851,8 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
17785
17851
|
return shim;
|
|
17786
17852
|
}
|
|
17787
17853
|
|
|
17854
|
+
var multipleUIlabel = kb.any(form, ui('label'));
|
|
17855
|
+
if (!multipleUIlabel) multipleUIlabel = utils.label(property);
|
|
17788
17856
|
var min = kb.any(form, ui('min')); // This is the minimum number -- default 0
|
|
17789
17857
|
|
|
17790
17858
|
min = min ? 0 + min.value : 0;
|
|
@@ -17825,10 +17893,9 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
17825
17893
|
img.setAttribute('src', plusIconURI); // plus sign
|
|
17826
17894
|
|
|
17827
17895
|
img.setAttribute('style', 'margin: 0.2em; width: 1.5em; height:1.5em');
|
|
17828
|
-
img.title = 'Click to add
|
|
17829
|
-
var prompt =
|
|
17830
|
-
prompt.textContent = (values.length === 0 ? 'Add
|
|
17831
|
-
|
|
17896
|
+
img.title = 'Click to add another ' + multipleUIlabel;
|
|
17897
|
+
var prompt = dom.createElement('span');
|
|
17898
|
+
prompt.textContent = (values.length === 0 ? 'Add another ' : 'Add ') + multipleUIlabel;
|
|
17832
17899
|
tail.addEventListener('click', /*#__PURE__*/function () {
|
|
17833
17900
|
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_eventNotUsed) {
|
|
17834
17901
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
@@ -17850,6 +17917,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
17850
17917
|
return _ref3.apply(this, arguments);
|
|
17851
17918
|
};
|
|
17852
17919
|
}(), true);
|
|
17920
|
+
tail.appendChild(prompt);
|
|
17853
17921
|
}
|
|
17854
17922
|
|
|
17855
17923
|
function createListIfNecessary() {
|
|
@@ -18111,28 +18179,38 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
|
|
|
18111
18179
|
**
|
|
18112
18180
|
** Not nested. Generates a link to something from a given class.
|
|
18113
18181
|
** Optional subform for the thing selected.
|
|
18182
|
+
** Generates a subForm based on a ui:use form
|
|
18183
|
+
** Will look like:
|
|
18184
|
+
** <div id=dropDownDiv>
|
|
18185
|
+
** <div id=labelOfDropDown>
|
|
18186
|
+
** <div id=selectDiv>
|
|
18187
|
+
** <select id=dropDownSelect>
|
|
18188
|
+
** <option> ....
|
|
18189
|
+
** <subForm>
|
|
18114
18190
|
** Alternative implementatons caould be:
|
|
18115
18191
|
** -- pop-up menu (as here)
|
|
18116
18192
|
** -- radio buttons
|
|
18117
18193
|
** -- auto-complete typing
|
|
18118
18194
|
**
|
|
18119
|
-
**
|
|
18195
|
+
** TODO: according to ontology ui:choice can also have ns.ui('default') - this is not implemented yet
|
|
18120
18196
|
*/
|
|
18121
18197
|
|
|
18122
18198
|
|
|
18123
18199
|
_fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, subject, form, dataDoc, callbackFunction) {
|
|
18124
18200
|
var ui = ns.ui;
|
|
18125
18201
|
var kb = _solidLogic.store;
|
|
18126
|
-
var multiple = false;
|
|
18127
18202
|
var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
|
|
18128
18203
|
|
|
18129
18204
|
var p;
|
|
18130
|
-
var box = dom.createElement('div');
|
|
18205
|
+
var box = dom.createElement('div');
|
|
18206
|
+
box.setAttribute('class', 'choiceBox'); // Set flexDirection column?
|
|
18131
18207
|
|
|
18132
18208
|
if (container) container.appendChild(box);
|
|
18133
18209
|
var lhs = dom.createElement('div');
|
|
18210
|
+
lhs.setAttribute('class', 'formFieldName choiceBox-label');
|
|
18134
18211
|
box.appendChild(lhs);
|
|
18135
18212
|
var rhs = dom.createElement('div');
|
|
18213
|
+
rhs.setAttribute('class', 'formFieldValue choiceBox-selectBox');
|
|
18136
18214
|
box.appendChild(rhs);
|
|
18137
18215
|
var property = kb.any(form, ui('property'));
|
|
18138
18216
|
|
|
@@ -18141,87 +18219,128 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18141
18219
|
}
|
|
18142
18220
|
|
|
18143
18221
|
lhs.appendChild((0, _basic.fieldLabel)(dom, property, form));
|
|
18144
|
-
var
|
|
18222
|
+
var uiFrom = kb.any(form, ui('from'));
|
|
18145
18223
|
|
|
18146
|
-
if (!
|
|
18224
|
+
if (!uiFrom) {
|
|
18147
18225
|
return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
|
|
18148
18226
|
}
|
|
18149
18227
|
|
|
18150
18228
|
var subForm = kb.any(form, ui('use')); // Optional
|
|
18229
|
+
// const follow = kb.anyJS(form, ui('follow'), null, formDoc) // data doc moves to new subject?
|
|
18151
18230
|
|
|
18152
|
-
var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
|
|
18153
|
-
|
|
18154
|
-
var possible = [];
|
|
18155
|
-
var possibleProperties;
|
|
18156
|
-
var nullLabel = '--' + utils.label(property) + '-?';
|
|
18157
18231
|
var opts = {
|
|
18158
18232
|
form: form,
|
|
18159
|
-
|
|
18160
|
-
nullLabel: nullLabel,
|
|
18233
|
+
subForm: subForm,
|
|
18161
18234
|
disambiguate: false
|
|
18162
18235
|
};
|
|
18163
|
-
possible = kb.each(undefined, ns.rdf('type'), from, formDoc);
|
|
18164
18236
|
|
|
18165
|
-
|
|
18166
|
-
possible
|
|
18167
|
-
|
|
18237
|
+
function getSelectorOptions() {
|
|
18238
|
+
var possible = [];
|
|
18239
|
+
var possibleProperties;
|
|
18240
|
+
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
18168
18241
|
|
|
18242
|
+
for (var x in kb.findMembersNT(uiFrom)) {
|
|
18243
|
+
possible.push(kb.fromNT(x));
|
|
18244
|
+
} // Use rdfs
|
|
18169
18245
|
|
|
18170
|
-
if (from.sameTerm(ns.rdfs('Class'))) {
|
|
18171
|
-
for (p in buttons.allClassURIs()) {
|
|
18172
|
-
possible.push(kb.sym(p));
|
|
18173
|
-
} // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
|
|
18174
18246
|
|
|
18175
|
-
|
|
18176
|
-
|
|
18247
|
+
if (uiFrom.sameTerm(ns.rdfs('Class'))) {
|
|
18248
|
+
for (p in buttons.allClassURIs()) {
|
|
18249
|
+
possible.push(kb.sym(p));
|
|
18250
|
+
} // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
|
|
18177
18251
|
|
|
18178
|
-
|
|
18179
|
-
|
|
18180
|
-
}
|
|
18252
|
+
} else if (uiFrom.sameTerm(ns.rdf('Property'))) {
|
|
18253
|
+
possibleProperties = buttons.propertyTriage(kb);
|
|
18181
18254
|
|
|
18182
|
-
|
|
18183
|
-
|
|
18184
|
-
|
|
18255
|
+
for (p in possibleProperties.op) {
|
|
18256
|
+
possible.push(kb.fromNT(p));
|
|
18257
|
+
}
|
|
18185
18258
|
|
|
18186
|
-
|
|
18187
|
-
|
|
18188
|
-
|
|
18259
|
+
for (p in possibleProperties.dp) {
|
|
18260
|
+
possible.push(kb.fromNT(p));
|
|
18261
|
+
}
|
|
18189
18262
|
|
|
18190
|
-
|
|
18191
|
-
|
|
18192
|
-
|
|
18263
|
+
opts.disambiguate = true; // This is a big class, and the labels won't be enough.
|
|
18264
|
+
} else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
|
|
18265
|
+
possibleProperties = buttons.propertyTriage(kb);
|
|
18193
18266
|
|
|
18194
|
-
|
|
18195
|
-
|
|
18196
|
-
|
|
18267
|
+
for (p in possibleProperties.op) {
|
|
18268
|
+
possible.push(kb.fromNT(p));
|
|
18269
|
+
}
|
|
18270
|
+
|
|
18271
|
+
opts.disambiguate = true;
|
|
18272
|
+
} else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
|
|
18273
|
+
possibleProperties = buttons.propertyTriage(kb);
|
|
18274
|
+
|
|
18275
|
+
for (p in possibleProperties.dp) {
|
|
18276
|
+
possible.push(kb.fromNT(p));
|
|
18277
|
+
}
|
|
18197
18278
|
|
|
18198
|
-
|
|
18199
|
-
possible.push(kb.fromNT(p));
|
|
18279
|
+
opts.disambiguate = true;
|
|
18200
18280
|
}
|
|
18201
18281
|
|
|
18202
|
-
|
|
18203
|
-
}
|
|
18282
|
+
return possible; // return sortByLabel(possible)
|
|
18283
|
+
} // TODO: this checks for any occurrence, regardless of true or false setting
|
|
18204
18284
|
|
|
18205
|
-
var object = kb.any(subject, property);
|
|
18206
18285
|
|
|
18207
|
-
|
|
18208
|
-
|
|
18209
|
-
(0, _fieldFunction.fieldFunction)(dom, subForm)(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
|
|
18286
|
+
if (kb.any(form, ui('canMintNew'))) {
|
|
18287
|
+
opts.mint = '* Create new *'; // @@ could be better
|
|
18210
18288
|
}
|
|
18211
18289
|
|
|
18212
|
-
var
|
|
18290
|
+
var multiSelect = kb.any(form, ui('multiselect')); // Optional
|
|
18213
18291
|
|
|
18214
|
-
|
|
18215
|
-
opts.mint = '* New *'; // @@ could be better
|
|
18292
|
+
var selector;
|
|
18216
18293
|
|
|
18217
|
-
|
|
18218
|
-
|
|
18294
|
+
rhs.refresh = function () {
|
|
18295
|
+
// from ui:property
|
|
18296
|
+
var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
|
|
18297
|
+
return object.value;
|
|
18298
|
+
}); // from ui:from + ui:property
|
|
18219
18299
|
|
|
18220
|
-
|
|
18221
|
-
|
|
18222
|
-
|
|
18300
|
+
var possibleOptions = getSelectorOptions();
|
|
18301
|
+
possibleOptions.push(selectedOptions);
|
|
18302
|
+
possibleOptions = sortByLabel(possibleOptions);
|
|
18303
|
+
selector = makeSelectForChoice(dom, rhs, kb, subject, property, possibleOptions, selectedOptions, uiFrom, opts, dataDoc, callbackFunction);
|
|
18304
|
+
rhs.innerHTML = '';
|
|
18305
|
+
rhs.appendChild(selector);
|
|
18306
|
+
|
|
18307
|
+
if (multiSelect) {
|
|
18308
|
+
var multiSelectDiv = new _multiSelect.IconicMultiSelect({
|
|
18309
|
+
placeholder: selector.selected,
|
|
18310
|
+
select: selector,
|
|
18311
|
+
container: rhs,
|
|
18312
|
+
textField: 'textField',
|
|
18313
|
+
valueField: 'valueField'
|
|
18314
|
+
});
|
|
18315
|
+
multiSelectDiv.init();
|
|
18316
|
+
multiSelectDiv.subscribe(function (event) {
|
|
18317
|
+
if (event.action === 'REMOVE_OPTION') {
|
|
18318
|
+
selectedOptions = selectedOptions.filter(function (value) {
|
|
18319
|
+
return value !== event.value;
|
|
18320
|
+
});
|
|
18321
|
+
}
|
|
18322
|
+
|
|
18323
|
+
if (event.action === 'CLEAR_ALL_OPTIONS') {
|
|
18324
|
+
selectedOptions = [];
|
|
18325
|
+
}
|
|
18326
|
+
|
|
18327
|
+
if (event.action === 'ADD_OPTION') {
|
|
18328
|
+
selectedOptions.push(event.value);
|
|
18329
|
+
}
|
|
18330
|
+
|
|
18331
|
+
selector.update(selectedOptions);
|
|
18332
|
+
});
|
|
18333
|
+
}
|
|
18334
|
+
};
|
|
18335
|
+
|
|
18336
|
+
rhs.refresh();
|
|
18337
|
+
if (selector && selector.refresh) selector.refresh();
|
|
18223
18338
|
return box;
|
|
18224
|
-
};
|
|
18339
|
+
};
|
|
18340
|
+
|
|
18341
|
+
function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
|
|
18342
|
+
(0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
|
|
18343
|
+
} // Documentation - non-interactive fields
|
|
18225
18344
|
//
|
|
18226
18345
|
|
|
18227
18346
|
|
|
@@ -18424,7 +18543,8 @@ function promptForNew(dom, kb, subject, predicate, theClass, form, dataDoc, call
|
|
|
18424
18543
|
b.setAttribute('type', 'button');
|
|
18425
18544
|
b.setAttribute('style', 'float: right;');
|
|
18426
18545
|
b.innerHTML = 'Goto ' + utils.label(theClass);
|
|
18427
|
-
b.addEventListener('click',
|
|
18546
|
+
b.addEventListener('click', // TODO fix dependency cycle to solid-panes by calling outlineManager
|
|
18547
|
+
function (_e) {
|
|
18428
18548
|
dom.outlineManager.GotoSubject(theClass, true, undefined, true, undefined);
|
|
18429
18549
|
}, false);
|
|
18430
18550
|
return box;
|
|
@@ -18559,10 +18679,8 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
18559
18679
|
// @param subject - a term, the subject of the statement(s) being edited.
|
|
18560
18680
|
// @param predicate - a term, the predicate of the statement(s) being edited
|
|
18561
18681
|
// @param possible - a list of terms, the possible value the object can take
|
|
18562
|
-
// @param options.multiple - Boolean - Whether more than one at a time is allowed
|
|
18563
18682
|
// @param options.nullLabel - a string to be displayed as the
|
|
18564
18683
|
// option for none selected (for non multiple)
|
|
18565
|
-
// @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
|
|
18566
18684
|
// @param options.subForm - If mint, then the form to be used for minting the new thing
|
|
18567
18685
|
// @param dataDoc - The web document being edited
|
|
18568
18686
|
// @param callbackFunction - takes (boolean ok, string errorBody)
|
|
@@ -18586,7 +18704,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18586
18704
|
} // uris is now the set of possible options
|
|
18587
18705
|
|
|
18588
18706
|
|
|
18589
|
-
if (n === 0
|
|
18707
|
+
if (n === 0) {
|
|
18590
18708
|
return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
|
|
18591
18709
|
}
|
|
18592
18710
|
|
|
@@ -18600,7 +18718,9 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18600
18718
|
actual = kb.findTypeURIs(subject);
|
|
18601
18719
|
} else {
|
|
18602
18720
|
kb.each(subject, predicate, null, dataDoc).forEach(function (x) {
|
|
18603
|
-
|
|
18721
|
+
if (x.uri) {
|
|
18722
|
+
actual[x.uri] = true;
|
|
18723
|
+
}
|
|
18604
18724
|
});
|
|
18605
18725
|
}
|
|
18606
18726
|
|
|
@@ -18621,33 +18741,8 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18621
18741
|
}
|
|
18622
18742
|
};
|
|
18623
18743
|
|
|
18624
|
-
var newObject;
|
|
18625
|
-
|
|
18626
18744
|
for (var _i = 0; _i < select.options.length; _i++) {
|
|
18627
18745
|
var opt = select.options[_i];
|
|
18628
|
-
|
|
18629
|
-
if (opt.selected && opt.AJAR_mint) {
|
|
18630
|
-
if (options.mintClass) {
|
|
18631
|
-
var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
|
|
18632
|
-
if (!ok) {
|
|
18633
|
-
callbackFunction(ok, body, {
|
|
18634
|
-
change: 'new'
|
|
18635
|
-
}); // @@ if ok, need some form of refresh of the select for the new thing
|
|
18636
|
-
}
|
|
18637
|
-
});
|
|
18638
|
-
select.parentNode.appendChild(thisForm);
|
|
18639
|
-
newObject = thisForm.AJAR_subject;
|
|
18640
|
-
} else {
|
|
18641
|
-
newObject = newThing(dataDoc);
|
|
18642
|
-
}
|
|
18643
|
-
|
|
18644
|
-
is.push($rdf.st(subject, predicate, newObject, dataDoc));
|
|
18645
|
-
|
|
18646
|
-
if (options.mintStatementsFun) {
|
|
18647
|
-
is = is.concat(options.mintStatementsFun(newObject));
|
|
18648
|
-
}
|
|
18649
|
-
}
|
|
18650
|
-
|
|
18651
18746
|
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
18652
18747
|
|
|
18653
18748
|
if (opt.selected && !(opt.AJAR_uri in actual)) {
|
|
@@ -18677,24 +18772,12 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18677
18772
|
sel = sel.superSelect;
|
|
18678
18773
|
}
|
|
18679
18774
|
|
|
18680
|
-
function doneNew(ok, _body) {
|
|
18681
|
-
callbackFunction(ok, {
|
|
18682
|
-
widget: 'select',
|
|
18683
|
-
event: 'new'
|
|
18684
|
-
});
|
|
18685
|
-
}
|
|
18686
|
-
|
|
18687
18775
|
log.info('selectForOptions: data doc = ' + dataDoc);
|
|
18688
18776
|
kb.updater.update(ds, is, function (uri, ok, body) {
|
|
18689
18777
|
actual = getActual(); // refresh
|
|
18690
18778
|
|
|
18691
18779
|
if (ok) {
|
|
18692
18780
|
select.disabled = false; // data written back
|
|
18693
|
-
|
|
18694
|
-
if (newObject) {
|
|
18695
|
-
var fn = (0, _fieldFunction.fieldFunction)(dom, options.subForm);
|
|
18696
|
-
fn(dom, select.parentNode, {}, newObject, options.subForm, dataDoc, doneNew);
|
|
18697
|
-
}
|
|
18698
18781
|
} else {
|
|
18699
18782
|
return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
|
|
18700
18783
|
}
|
|
@@ -18708,7 +18791,6 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18708
18791
|
|
|
18709
18792
|
var select = dom.createElement('select');
|
|
18710
18793
|
select.setAttribute('style', style.formSelectSTyle);
|
|
18711
|
-
if (options.multiple) select.setAttribute('multiple', 'true');
|
|
18712
18794
|
select.currentURI = null;
|
|
18713
18795
|
|
|
18714
18796
|
select.refresh = function () {
|
|
@@ -18751,15 +18833,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18751
18833
|
select.appendChild(option);
|
|
18752
18834
|
}
|
|
18753
18835
|
|
|
18754
|
-
if (
|
|
18755
|
-
var mint = dom.createElement('option');
|
|
18756
|
-
mint.appendChild(dom.createTextNode(options.mint));
|
|
18757
|
-
mint.AJAR_mint = true; // Flag it
|
|
18758
|
-
|
|
18759
|
-
select.insertBefore(mint, select.firstChild);
|
|
18760
|
-
}
|
|
18761
|
-
|
|
18762
|
-
if (select.currentURI == null && !options.multiple) {
|
|
18836
|
+
if (!select.currentURI) {
|
|
18763
18837
|
var prompt = dom.createElement('option');
|
|
18764
18838
|
prompt.appendChild(dom.createTextNode(options.nullLabel));
|
|
18765
18839
|
select.insertBefore(prompt, select.firstChild);
|
|
@@ -18782,28 +18856,16 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18782
18856
|
function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
|
|
18783
18857
|
var du = kb.any(category, ns.owl('disjointUnionOf'));
|
|
18784
18858
|
var subs;
|
|
18785
|
-
var multiple = false;
|
|
18786
18859
|
|
|
18787
18860
|
if (!du) {
|
|
18788
18861
|
subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
|
|
18789
|
-
multiple = true;
|
|
18790
18862
|
} else {
|
|
18791
18863
|
subs = du.elements;
|
|
18792
18864
|
}
|
|
18793
18865
|
|
|
18794
18866
|
log.debug('Select list length ' + subs.length);
|
|
18795
|
-
|
|
18796
|
-
if (subs.length === 0) {
|
|
18797
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
|
|
18798
|
-
}
|
|
18799
|
-
|
|
18800
|
-
if (subs.length === 1) {
|
|
18801
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
|
|
18802
|
-
}
|
|
18803
|
-
|
|
18804
18867
|
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
|
|
18805
|
-
|
|
18806
|
-
nullPrompt: '--classify--'
|
|
18868
|
+
nullLabel: '* Select type *'
|
|
18807
18869
|
}, dataDoc, callbackFunction);
|
|
18808
18870
|
}
|
|
18809
18871
|
/** Make SELECT element to select subclasses recurively
|
|
@@ -18837,8 +18899,7 @@ function makeSelectForNestedCategory(dom, kb, subject, category, dataDoc, callba
|
|
|
18837
18899
|
function onChange(ok, body) {
|
|
18838
18900
|
if (ok) update();
|
|
18839
18901
|
callbackFunction(ok, body);
|
|
18840
|
-
}
|
|
18841
|
-
|
|
18902
|
+
}
|
|
18842
18903
|
|
|
18843
18904
|
var select = makeSelectForCategory(dom, kb, subject, category, dataDoc, onChange);
|
|
18844
18905
|
container.appendChild(select);
|
|
@@ -18993,6 +19054,264 @@ function newThing(doc) {
|
|
|
18993
19054
|
var now = new Date();
|
|
18994
19055
|
return $rdf.sym(doc.uri + '#' + 'id' + ('' + now.getTime()));
|
|
18995
19056
|
}
|
|
19057
|
+
/** Make SELECT element to select options
|
|
19058
|
+
//
|
|
19059
|
+
// @param subject - a term, the subject of the statement(s) being edited.
|
|
19060
|
+
// @param predicate - a term, the predicate of the statement(s) being edited
|
|
19061
|
+
// @param possible - a list of terms, the possible value the object can take
|
|
19062
|
+
// @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
|
|
19063
|
+
// @param options.subForm - If mint, then the form to be used for minting the new thing
|
|
19064
|
+
// @param dataDoc - The web document being edited
|
|
19065
|
+
// @param callbackFunction - takes (boolean ok, string errorBody)
|
|
19066
|
+
*/
|
|
19067
|
+
|
|
19068
|
+
|
|
19069
|
+
function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossibleOptions, selectedOptions, uiFrom, options, dataDoc, callbackFunction) {
|
|
19070
|
+
var optionsFromClassUIfrom = {}; // Count them
|
|
19071
|
+
|
|
19072
|
+
var editable = kb.updater.editable(dataDoc.uri);
|
|
19073
|
+
|
|
19074
|
+
for (var i = 0; i < inputPossibleOptions.length; i++) {
|
|
19075
|
+
var sub = inputPossibleOptions[i]; // @@ Maybe; make this so it works with blank nodes too
|
|
19076
|
+
// if (!sub.uri) debug.warn(`makeSelectForChoice: option does not have an uri: ${sub}, with predicate: ${predicate}`)
|
|
19077
|
+
|
|
19078
|
+
if (!sub.uri || sub.uri in optionsFromClassUIfrom) continue;
|
|
19079
|
+
optionsFromClassUIfrom[sub.uri] = true;
|
|
19080
|
+
}
|
|
19081
|
+
|
|
19082
|
+
var isEmpty = Object.keys(optionsFromClassUIfrom).length === 0;
|
|
19083
|
+
|
|
19084
|
+
if (isEmpty && !options.mint) {
|
|
19085
|
+
return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
|
|
19086
|
+
}
|
|
19087
|
+
|
|
19088
|
+
log.debug('makeSelectForChoice: dataDoc=' + dataDoc);
|
|
19089
|
+
|
|
19090
|
+
function createDefaultSelectOptionText() {
|
|
19091
|
+
var firstSelectOptionText = '--- choice ---';
|
|
19092
|
+
|
|
19093
|
+
if (predicate && !(predicate.termType === 'BlankNode')) {
|
|
19094
|
+
firstSelectOptionText = '* Select for property: ' + utils.label(predicate) + ' *';
|
|
19095
|
+
}
|
|
19096
|
+
|
|
19097
|
+
if (subject && !(subject.termType === 'BlankNode')) {
|
|
19098
|
+
firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *';
|
|
19099
|
+
}
|
|
19100
|
+
|
|
19101
|
+
return firstSelectOptionText;
|
|
19102
|
+
}
|
|
19103
|
+
|
|
19104
|
+
function createDefaultSelectOption() {
|
|
19105
|
+
var option = dom.createElement('option');
|
|
19106
|
+
option.appendChild(dom.createTextNode(createDefaultSelectOptionText()));
|
|
19107
|
+
option.disabled = true;
|
|
19108
|
+
option.value = true;
|
|
19109
|
+
option.hidden = true;
|
|
19110
|
+
option.selected = true;
|
|
19111
|
+
return option;
|
|
19112
|
+
}
|
|
19113
|
+
|
|
19114
|
+
var onChange = function onChange(_e) {
|
|
19115
|
+
container.removeChild(container.lastChild);
|
|
19116
|
+
select.refresh();
|
|
19117
|
+
};
|
|
19118
|
+
|
|
19119
|
+
var select = dom.createElement('select');
|
|
19120
|
+
select.setAttribute('style', style.formSelectSTyle);
|
|
19121
|
+
select.setAttribute('id', 'formSelect');
|
|
19122
|
+
select.currentURI = null;
|
|
19123
|
+
|
|
19124
|
+
for (var uri in optionsFromClassUIfrom) {
|
|
19125
|
+
select.appendChild(createOption(uri));
|
|
19126
|
+
}
|
|
19127
|
+
|
|
19128
|
+
if (editable && options.mint) {
|
|
19129
|
+
var mint = dom.createElement('option');
|
|
19130
|
+
mint.appendChild(dom.createTextNode(options.mint));
|
|
19131
|
+
mint.AJAR_mint = true; // Flag it
|
|
19132
|
+
|
|
19133
|
+
select.insertBefore(mint, select.firstChild);
|
|
19134
|
+
}
|
|
19135
|
+
|
|
19136
|
+
if (select.children.length === 0) select.insertBefore(createDefaultSelectOption(), select.firstChild);
|
|
19137
|
+
|
|
19138
|
+
select.update = function (newSelectedOptions) {
|
|
19139
|
+
selectedOptions = newSelectedOptions;
|
|
19140
|
+
var ds = [];
|
|
19141
|
+
var is = [];
|
|
19142
|
+
|
|
19143
|
+
var removeValue = function removeValue(t) {
|
|
19144
|
+
if (kb.holds(subject, predicate, t, dataDoc)) {
|
|
19145
|
+
ds.push($rdf.st(subject, predicate, t, dataDoc));
|
|
19146
|
+
}
|
|
19147
|
+
};
|
|
19148
|
+
|
|
19149
|
+
var addValue = function addValue(t) {
|
|
19150
|
+
if (!kb.holds(subject, predicate, t, dataDoc)) {
|
|
19151
|
+
is.push($rdf.st(subject, predicate, t, dataDoc)); // console.log("----value added " + t)
|
|
19152
|
+
}
|
|
19153
|
+
|
|
19154
|
+
if (uiFrom && !kb.holds(t, ns.rdf('type'), kb.sym(uiFrom), dataDoc)) {
|
|
19155
|
+
is.push($rdf.st(t, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // console.log("----added type to value " + uiFrom)
|
|
19156
|
+
}
|
|
19157
|
+
};
|
|
19158
|
+
|
|
19159
|
+
var existingValues = kb.each(subject, predicate, null, dataDoc).map(function (object) {
|
|
19160
|
+
return object.value;
|
|
19161
|
+
});
|
|
19162
|
+
|
|
19163
|
+
var _iterator2 = _createForOfIteratorHelper(existingValues),
|
|
19164
|
+
_step2;
|
|
19165
|
+
|
|
19166
|
+
try {
|
|
19167
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
19168
|
+
var value = _step2.value;
|
|
19169
|
+
if (!containsObject(value, selectedOptions)) removeValue($rdf.sym(value));
|
|
19170
|
+
}
|
|
19171
|
+
} catch (err) {
|
|
19172
|
+
_iterator2.e(err);
|
|
19173
|
+
} finally {
|
|
19174
|
+
_iterator2.f();
|
|
19175
|
+
}
|
|
19176
|
+
|
|
19177
|
+
var _iterator3 = _createForOfIteratorHelper(selectedOptions),
|
|
19178
|
+
_step3;
|
|
19179
|
+
|
|
19180
|
+
try {
|
|
19181
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
19182
|
+
var _value = _step3.value;
|
|
19183
|
+
if (!(_value in existingValues)) addValue($rdf.sym(_value));
|
|
19184
|
+
}
|
|
19185
|
+
} catch (err) {
|
|
19186
|
+
_iterator3.e(err);
|
|
19187
|
+
} finally {
|
|
19188
|
+
_iterator3.f();
|
|
19189
|
+
}
|
|
19190
|
+
|
|
19191
|
+
kb.updater.update(ds, is, function (uri, ok, body) {
|
|
19192
|
+
if (!ok) return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
|
|
19193
|
+
select.refresh();
|
|
19194
|
+
if (callbackFunction) callbackFunction(ok, {
|
|
19195
|
+
widget: 'select',
|
|
19196
|
+
event: 'change'
|
|
19197
|
+
});
|
|
19198
|
+
});
|
|
19199
|
+
};
|
|
19200
|
+
|
|
19201
|
+
select.refresh = function () {
|
|
19202
|
+
select.disabled = true; // unlocked any conflict we had got into
|
|
19203
|
+
|
|
19204
|
+
var is = [];
|
|
19205
|
+
var newObject;
|
|
19206
|
+
|
|
19207
|
+
for (var _i3 = 0; _i3 < select.options.length; _i3++) {
|
|
19208
|
+
var opt = select.options[_i3];
|
|
19209
|
+
|
|
19210
|
+
if (opt.selected && opt.AJAR_mint) {
|
|
19211
|
+
// not sure if this 'if' is used because I cannot find mintClass
|
|
19212
|
+
if (options.mintClass) {
|
|
19213
|
+
var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
|
|
19214
|
+
if (!ok) {
|
|
19215
|
+
callbackFunction(ok, body, {
|
|
19216
|
+
change: 'new'
|
|
19217
|
+
}); // @@ if ok, need some form of refresh of the select for the new thing
|
|
19218
|
+
}
|
|
19219
|
+
});
|
|
19220
|
+
select.parentNode.appendChild(thisForm);
|
|
19221
|
+
newObject = thisForm.AJAR_subject;
|
|
19222
|
+
} else {
|
|
19223
|
+
newObject = newThing(dataDoc);
|
|
19224
|
+
}
|
|
19225
|
+
|
|
19226
|
+
is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
|
|
19227
|
+
if (uiFrom) is.push($rdf.st(newObject, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // not sure if this 'if' is used because I cannot find mintStatementsFun
|
|
19228
|
+
|
|
19229
|
+
if (options.mintStatementsFun) {
|
|
19230
|
+
is = is.concat(options.mintStatementsFun(newObject));
|
|
19231
|
+
}
|
|
19232
|
+
|
|
19233
|
+
select.currentURI = newObject;
|
|
19234
|
+
}
|
|
19235
|
+
|
|
19236
|
+
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
19237
|
+
|
|
19238
|
+
if (opt.selected && containsObject(opt.AJAR_uri, selectedOptions)) {
|
|
19239
|
+
select.currentURI = opt.AJAR_uri;
|
|
19240
|
+
}
|
|
19241
|
+
|
|
19242
|
+
if (!containsObject(opt.AJAR_uri, selectedOptions)) opt.removeAttribute('selected');
|
|
19243
|
+
if (containsObject(opt.AJAR_uri, selectedOptions)) opt.setAttribute('selected', 'true');
|
|
19244
|
+
}
|
|
19245
|
+
|
|
19246
|
+
log.info('selectForOptions: data doc = ' + dataDoc);
|
|
19247
|
+
|
|
19248
|
+
if (select.currentURI && options.subForm) {
|
|
19249
|
+
addSubFormChoice(dom, container, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
|
|
19250
|
+
if (ok) {
|
|
19251
|
+
kb.updater.update([], is, function (uri, success, errorBody) {
|
|
19252
|
+
if (!success) container.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
|
|
19253
|
+
});
|
|
19254
|
+
if (callbackFunction) callbackFunction(ok, {
|
|
19255
|
+
widget: 'select',
|
|
19256
|
+
event: 'new'
|
|
19257
|
+
});
|
|
19258
|
+
} else {
|
|
19259
|
+
container.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
|
|
19260
|
+
}
|
|
19261
|
+
});
|
|
19262
|
+
}
|
|
19263
|
+
|
|
19264
|
+
select.disabled = false;
|
|
19265
|
+
};
|
|
19266
|
+
|
|
19267
|
+
function createOption(uri) {
|
|
19268
|
+
var option = dom.createElement('option');
|
|
19269
|
+
var c = kb.sym(uri);
|
|
19270
|
+
var label;
|
|
19271
|
+
|
|
19272
|
+
if (options.disambiguate) {
|
|
19273
|
+
label = utils.labelWithOntology(c, true); // Init. cap
|
|
19274
|
+
} else {
|
|
19275
|
+
label = utils.label(c, true);
|
|
19276
|
+
}
|
|
19277
|
+
|
|
19278
|
+
option.appendChild(dom.createTextNode(label)); // Init.
|
|
19279
|
+
|
|
19280
|
+
option.setAttribute('value', uri);
|
|
19281
|
+
var backgroundColor = kb.any(c, kb.sym('http://www.w3.org/ns/ui#backgroundColor'));
|
|
19282
|
+
|
|
19283
|
+
if (backgroundColor) {
|
|
19284
|
+
option.setAttribute('style', 'background-color: ' + backgroundColor.value + '; ');
|
|
19285
|
+
}
|
|
19286
|
+
|
|
19287
|
+
option.AJAR_uri = uri;
|
|
19288
|
+
|
|
19289
|
+
if (containsObject(c.value, selectedOptions)) {
|
|
19290
|
+
option.setAttribute('selected', 'true');
|
|
19291
|
+
}
|
|
19292
|
+
|
|
19293
|
+
return option;
|
|
19294
|
+
}
|
|
19295
|
+
|
|
19296
|
+
if (editable) {
|
|
19297
|
+
select.addEventListener('change', onChange, false);
|
|
19298
|
+
}
|
|
19299
|
+
|
|
19300
|
+
return select;
|
|
19301
|
+
} // makeSelectForChoice
|
|
19302
|
+
|
|
19303
|
+
|
|
19304
|
+
function containsObject(obj, list) {
|
|
19305
|
+
var i;
|
|
19306
|
+
|
|
19307
|
+
for (i = 0; i < list.length; i++) {
|
|
19308
|
+
if (list[i] === obj) {
|
|
19309
|
+
return true;
|
|
19310
|
+
}
|
|
19311
|
+
}
|
|
19312
|
+
|
|
19313
|
+
return false;
|
|
19314
|
+
}
|
|
18996
19315
|
//# sourceMappingURL=forms.js.map
|
|
18997
19316
|
|
|
18998
19317
|
/***/ }),
|
|
@@ -20767,7 +21086,7 @@ function queryESCODataByName(_x, _x2, _x3) {
|
|
|
20767
21086
|
*
|
|
20768
21087
|
* Wikidata bug: https://phabricator.wikimedia.org/T283962
|
|
20769
21088
|
* This will not be needed whn that WDQS bug fixed.
|
|
20770
|
-
* This is aptured in https://github.com/
|
|
21089
|
+
* This is aptured in https://github.com/solidos/solid-ui/issues/403
|
|
20771
21090
|
*/
|
|
20772
21091
|
|
|
20773
21092
|
|
|
@@ -21967,6 +22286,800 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21967
22286
|
|
|
21968
22287
|
/***/ }),
|
|
21969
22288
|
|
|
22289
|
+
/***/ "./lib/widgets/multiSelect.js":
|
|
22290
|
+
/*!************************************!*\
|
|
22291
|
+
!*** ./lib/widgets/multiSelect.js ***!
|
|
22292
|
+
\************************************/
|
|
22293
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
22294
|
+
|
|
22295
|
+
"use strict";
|
|
22296
|
+
|
|
22297
|
+
|
|
22298
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
22299
|
+
|
|
22300
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
22301
|
+
|
|
22302
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
22303
|
+
value: true
|
|
22304
|
+
}));
|
|
22305
|
+
exports.IconicMultiSelect = void 0;
|
|
22306
|
+
|
|
22307
|
+
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
|
|
22308
|
+
|
|
22309
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
22310
|
+
|
|
22311
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
22312
|
+
|
|
22313
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
22314
|
+
|
|
22315
|
+
var style = _interopRequireWildcard(__webpack_require__(/*! ../style_multiSelect */ "./lib/style_multiSelect.js"));
|
|
22316
|
+
|
|
22317
|
+
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); }
|
|
22318
|
+
|
|
22319
|
+
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; }
|
|
22320
|
+
|
|
22321
|
+
/*
|
|
22322
|
+
* IconicMultiSelect v0.7.0
|
|
22323
|
+
* Licence: MIT
|
|
22324
|
+
* (c) 2021 Sidney Wimart.
|
|
22325
|
+
* repo & configuration: https://github.com/sidneywm/iconic-multiselect
|
|
22326
|
+
*/
|
|
22327
|
+
|
|
22328
|
+
/**
|
|
22329
|
+
* @version IconicMultiSelect v0.7.0
|
|
22330
|
+
* @licence MIT
|
|
22331
|
+
*/
|
|
22332
|
+
var IconicMultiSelect = /*#__PURE__*/function () {
|
|
22333
|
+
/**
|
|
22334
|
+
* Iconic Multiselect constructor.
|
|
22335
|
+
* @param { Object[] } data - Array of objects.
|
|
22336
|
+
* @param { string } noData - Defines the message when there is no data input.
|
|
22337
|
+
* @param { string } noResults - Defines the message when there is no result if options are filtered.
|
|
22338
|
+
* @param { string } placeholder - Defines the placeholder's text.
|
|
22339
|
+
* @param { string } select - DOM element to be selected. It must be a HTML Select tag - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
|
|
22340
|
+
* @param { string } textField - Field to select in the object for the text.
|
|
22341
|
+
* @param { string } valueField - Field to select in the object for the value.
|
|
22342
|
+
*/
|
|
22343
|
+
function IconicMultiSelect(_ref) {
|
|
22344
|
+
var data = _ref.data,
|
|
22345
|
+
itemTemplate = _ref.itemTemplate,
|
|
22346
|
+
noData = _ref.noData,
|
|
22347
|
+
noResults = _ref.noResults,
|
|
22348
|
+
placeholder = _ref.placeholder,
|
|
22349
|
+
select = _ref.select,
|
|
22350
|
+
container = _ref.container,
|
|
22351
|
+
tagTemplate = _ref.tagTemplate,
|
|
22352
|
+
textField = _ref.textField,
|
|
22353
|
+
valueField = _ref.valueField;
|
|
22354
|
+
(0, _classCallCheck2["default"])(this, IconicMultiSelect);
|
|
22355
|
+
(0, _defineProperty2["default"])(this, "_data", void 0);
|
|
22356
|
+
(0, _defineProperty2["default"])(this, "_domElements", void 0);
|
|
22357
|
+
(0, _defineProperty2["default"])(this, "_event", function () {});
|
|
22358
|
+
(0, _defineProperty2["default"])(this, "_itemTemplate", void 0);
|
|
22359
|
+
(0, _defineProperty2["default"])(this, "_multiselect", void 0);
|
|
22360
|
+
(0, _defineProperty2["default"])(this, "_noData", void 0);
|
|
22361
|
+
(0, _defineProperty2["default"])(this, "_noResults", void 0);
|
|
22362
|
+
(0, _defineProperty2["default"])(this, "_options", []);
|
|
22363
|
+
(0, _defineProperty2["default"])(this, "_placeholder", void 0);
|
|
22364
|
+
(0, _defineProperty2["default"])(this, "_select", void 0);
|
|
22365
|
+
(0, _defineProperty2["default"])(this, "_selectContainer", void 0);
|
|
22366
|
+
(0, _defineProperty2["default"])(this, "_selectedOptions", []);
|
|
22367
|
+
(0, _defineProperty2["default"])(this, "_tagTemplate", void 0);
|
|
22368
|
+
(0, _defineProperty2["default"])(this, "_textField", void 0);
|
|
22369
|
+
(0, _defineProperty2["default"])(this, "_valueField", void 0);
|
|
22370
|
+
(0, _defineProperty2["default"])(this, "_cross", "\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M6.2253 4.81108C5.83477 4.42056 5.20161 4.42056 4.81108 4.81108C4.42056 5.20161 4.42056 5.83477 4.81108 6.2253L10.5858 12L4.81114 17.7747C4.42062 18.1652 4.42062 18.7984 4.81114 19.1889C5.20167 19.5794 5.83483 19.5794 6.22535 19.1889L12 13.4142L17.7747 19.1889C18.1652 19.5794 18.7984 19.5794 19.1889 19.1889C19.5794 18.7984 19.5794 18.1652 19.1889 17.7747L13.4142 12L19.189 6.2253C19.5795 5.83477 19.5795 5.20161 19.189 4.81108C18.7985 4.42056 18.1653 4.42056 17.7748 4.81108L12 10.5858L6.2253 4.81108Z\"\n fill=\"currentColor\"\n />\n </svg>\n ");
|
|
22371
|
+
this._data = data !== null && data !== void 0 ? data : [];
|
|
22372
|
+
this._itemTemplate = itemTemplate !== null && itemTemplate !== void 0 ? itemTemplate : null;
|
|
22373
|
+
this._noData = noData !== null && noData !== void 0 ? noData : 'No data found.';
|
|
22374
|
+
this._noResults = noResults !== null && noResults !== void 0 ? noResults : 'No results found.';
|
|
22375
|
+
this._placeholder = placeholder !== null && placeholder !== void 0 ? placeholder : 'Select...';
|
|
22376
|
+
this._select = select; // Timea added a container here
|
|
22377
|
+
|
|
22378
|
+
this._selectContainer = container;
|
|
22379
|
+
this._tagTemplate = tagTemplate !== null && tagTemplate !== void 0 ? tagTemplate : null;
|
|
22380
|
+
this._textField = textField !== null && textField !== void 0 ? textField : null;
|
|
22381
|
+
this._valueField = valueField !== null && valueField !== void 0 ? valueField : null;
|
|
22382
|
+
}
|
|
22383
|
+
/**
|
|
22384
|
+
* Initialize the Iconic Multiselect component.
|
|
22385
|
+
* @public
|
|
22386
|
+
*/
|
|
22387
|
+
|
|
22388
|
+
|
|
22389
|
+
(0, _createClass2["default"])(IconicMultiSelect, [{
|
|
22390
|
+
key: "init",
|
|
22391
|
+
value: function init() {
|
|
22392
|
+
// Timea change to use this._select instead of this._selectContainer
|
|
22393
|
+
if (this._select && this._select.nodeName === 'SELECT') {
|
|
22394
|
+
if (this._itemTemplate && this._data.length === 0) {
|
|
22395
|
+
throw new Error('itemTemplate must be initialized with data from the component settings');
|
|
22396
|
+
}
|
|
22397
|
+
|
|
22398
|
+
if (this._tagTemplate && this._data.length === 0) {
|
|
22399
|
+
throw new Error('tagTemplate must be initialized with data from the component settings');
|
|
22400
|
+
}
|
|
22401
|
+
|
|
22402
|
+
this._options = this._data.length > 0 ? this._getDataFromSettings() : this._getDataFromSelectTag();
|
|
22403
|
+
|
|
22404
|
+
this._renderMultiselect();
|
|
22405
|
+
|
|
22406
|
+
this._renderOptionsList();
|
|
22407
|
+
|
|
22408
|
+
this._domElements = {
|
|
22409
|
+
clear: this._multiselect.querySelector('.multiselect__clear-btn'),
|
|
22410
|
+
input: this._multiselect.querySelector('.multiselect__input'),
|
|
22411
|
+
optionsContainer: this._multiselect.querySelector('.multiselect__options'),
|
|
22412
|
+
optionsContainerList: this._multiselect.querySelector('.multiselect__options > ul'),
|
|
22413
|
+
options: {
|
|
22414
|
+
list: this._multiselect.querySelectorAll('.multiselect__options > ul > li'),
|
|
22415
|
+
find: function find(callbackFn) {
|
|
22416
|
+
for (var i = 0; i < this.list.length; i++) {
|
|
22417
|
+
var node = this.list[i];
|
|
22418
|
+
if (callbackFn(node)) return node;
|
|
22419
|
+
}
|
|
22420
|
+
|
|
22421
|
+
return undefined;
|
|
22422
|
+
},
|
|
22423
|
+
some: function some(callbackFn) {
|
|
22424
|
+
for (var i = 0; i < this.list.length; i++) {
|
|
22425
|
+
var node = this.list[i];
|
|
22426
|
+
if (callbackFn(node, i)) return true;
|
|
22427
|
+
}
|
|
22428
|
+
|
|
22429
|
+
return false;
|
|
22430
|
+
}
|
|
22431
|
+
}
|
|
22432
|
+
};
|
|
22433
|
+
|
|
22434
|
+
this._enableEventListenners();
|
|
22435
|
+
|
|
22436
|
+
this._initSelectedList();
|
|
22437
|
+
} else {
|
|
22438
|
+
throw new Error("The selector '".concat(this._select, "' did not select any valid select tag."));
|
|
22439
|
+
}
|
|
22440
|
+
}
|
|
22441
|
+
/**
|
|
22442
|
+
* Subscribes to the emitted events.
|
|
22443
|
+
* @param { Function } callback - Callback function which emits a custom event object.
|
|
22444
|
+
* @public
|
|
22445
|
+
*/
|
|
22446
|
+
|
|
22447
|
+
}, {
|
|
22448
|
+
key: "subscribe",
|
|
22449
|
+
value: function subscribe(callback) {
|
|
22450
|
+
if (typeof callback === 'function') {
|
|
22451
|
+
this._event = callback;
|
|
22452
|
+
} else {
|
|
22453
|
+
throw new Error('parameter in the subscribe method is not a function');
|
|
22454
|
+
}
|
|
22455
|
+
}
|
|
22456
|
+
/**
|
|
22457
|
+
* Add an option to the selection list.
|
|
22458
|
+
* @param { Object: { text: string; value: string; }} option
|
|
22459
|
+
* @private
|
|
22460
|
+
*/
|
|
22461
|
+
|
|
22462
|
+
}, {
|
|
22463
|
+
key: "_addOptionToList",
|
|
22464
|
+
value: function _addOptionToList(option, index) {
|
|
22465
|
+
var _this = this;
|
|
22466
|
+
|
|
22467
|
+
var html = "<span class=\"multiselect__selected\" style=\"".concat(style.multiselect__selected, "\" data-value=\"").concat(option.value, "\">").concat(this._tagTemplate ? this._processTemplate(this._tagTemplate, index) : option.text, "<span class=\"multiselect__remove-btn\" style=\"").concat(style.multiselect__remove_btn, "\">").concat(this._cross, "</span></span>");
|
|
22468
|
+
|
|
22469
|
+
this._domElements.input.insertAdjacentHTML('beforebegin', html);
|
|
22470
|
+
|
|
22471
|
+
var _this$_multiselect$qu = this._multiselect.querySelector("span[data-value=\"".concat(option.value, "\"]")),
|
|
22472
|
+
removeBtn = _this$_multiselect$qu.lastElementChild;
|
|
22473
|
+
|
|
22474
|
+
removeBtn.addEventListener('click', function () {
|
|
22475
|
+
var target = _this._domElements.options.find(function (el) {
|
|
22476
|
+
return el.dataset.value === option.value;
|
|
22477
|
+
});
|
|
22478
|
+
|
|
22479
|
+
_this._handleOption(target);
|
|
22480
|
+
});
|
|
22481
|
+
}
|
|
22482
|
+
/**
|
|
22483
|
+
* Clears all selected options.
|
|
22484
|
+
* @private
|
|
22485
|
+
*/
|
|
22486
|
+
|
|
22487
|
+
}, {
|
|
22488
|
+
key: "_clearSelection",
|
|
22489
|
+
value: function _clearSelection() {
|
|
22490
|
+
var _this2 = this;
|
|
22491
|
+
|
|
22492
|
+
var _loop = function _loop(i) {
|
|
22493
|
+
var option = _this2._selectedOptions[i];
|
|
22494
|
+
|
|
22495
|
+
var target = _this2._domElements.options.find(function (el) {
|
|
22496
|
+
return el.dataset.value === option.value;
|
|
22497
|
+
});
|
|
22498
|
+
|
|
22499
|
+
target.classList.remove('multiselect__options--selected');
|
|
22500
|
+
target.setAttribute('style', style.multiselect__options);
|
|
22501
|
+
|
|
22502
|
+
_this2._removeOptionFromList(target.dataset.value);
|
|
22503
|
+
};
|
|
22504
|
+
|
|
22505
|
+
for (var i = 0; i < this._selectedOptions.length; i++) {
|
|
22506
|
+
_loop(i);
|
|
22507
|
+
}
|
|
22508
|
+
|
|
22509
|
+
this._selectedOptions = [];
|
|
22510
|
+
|
|
22511
|
+
this._handleClearSelectionBtn();
|
|
22512
|
+
|
|
22513
|
+
this._handlePlaceholder();
|
|
22514
|
+
|
|
22515
|
+
this._dispatchEvent({
|
|
22516
|
+
action: 'CLEAR_ALL_OPTIONS',
|
|
22517
|
+
selection: this._selectedOptions
|
|
22518
|
+
});
|
|
22519
|
+
}
|
|
22520
|
+
/**
|
|
22521
|
+
* Close the options container.
|
|
22522
|
+
* @private
|
|
22523
|
+
*/
|
|
22524
|
+
|
|
22525
|
+
}, {
|
|
22526
|
+
key: "_closeList",
|
|
22527
|
+
value: function _closeList() {
|
|
22528
|
+
this._domElements.input.value = '';
|
|
22529
|
+
|
|
22530
|
+
this._domElements.optionsContainer.classList.remove('visible');
|
|
22531
|
+
|
|
22532
|
+
this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
|
|
22533
|
+
|
|
22534
|
+
this._filterOptions('');
|
|
22535
|
+
|
|
22536
|
+
this._removeAllArrowSelected();
|
|
22537
|
+
}
|
|
22538
|
+
/**
|
|
22539
|
+
* Dispatches new events.
|
|
22540
|
+
* @param { object : { action: string; selection: { option: string; text: string; }[]; value?: string; } } event
|
|
22541
|
+
* @private
|
|
22542
|
+
*/
|
|
22543
|
+
|
|
22544
|
+
}, {
|
|
22545
|
+
key: "_dispatchEvent",
|
|
22546
|
+
value: function _dispatchEvent(event) {
|
|
22547
|
+
this._event(event);
|
|
22548
|
+
}
|
|
22549
|
+
/**
|
|
22550
|
+
* Enables all main event listenners.
|
|
22551
|
+
* @private
|
|
22552
|
+
*/
|
|
22553
|
+
|
|
22554
|
+
}, {
|
|
22555
|
+
key: "_enableEventListenners",
|
|
22556
|
+
value: function _enableEventListenners() {
|
|
22557
|
+
var _this3 = this;
|
|
22558
|
+
|
|
22559
|
+
document.addEventListener('mouseup', function (_ref2) {
|
|
22560
|
+
var target = _ref2.target;
|
|
22561
|
+
|
|
22562
|
+
if (!_this3._multiselect.contains(target)) {
|
|
22563
|
+
_this3._filterOptions('');
|
|
22564
|
+
|
|
22565
|
+
_this3._closeList();
|
|
22566
|
+
|
|
22567
|
+
_this3._handlePlaceholder();
|
|
22568
|
+
}
|
|
22569
|
+
});
|
|
22570
|
+
|
|
22571
|
+
this._domElements.clear.addEventListener('click', function () {
|
|
22572
|
+
_this3._clearSelection();
|
|
22573
|
+
});
|
|
22574
|
+
|
|
22575
|
+
for (var i = 0; i < this._domElements.options.list.length; i++) {
|
|
22576
|
+
var option = this._domElements.options.list[i];
|
|
22577
|
+
option.addEventListener('click', function (_ref3) {
|
|
22578
|
+
var target = _ref3.target;
|
|
22579
|
+
|
|
22580
|
+
_this3._handleOption(target);
|
|
22581
|
+
|
|
22582
|
+
_this3._closeList();
|
|
22583
|
+
});
|
|
22584
|
+
}
|
|
22585
|
+
|
|
22586
|
+
this._domElements.input.addEventListener('focus', function () {
|
|
22587
|
+
_this3._domElements.optionsContainer.classList.add('visible');
|
|
22588
|
+
|
|
22589
|
+
_this3._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
|
|
22590
|
+
});
|
|
22591
|
+
|
|
22592
|
+
this._domElements.input.addEventListener('input', function (_ref4) {
|
|
22593
|
+
var value = _ref4.target.value;
|
|
22594
|
+
|
|
22595
|
+
if (_this3._domElements.options.list.length > 0) {
|
|
22596
|
+
_this3._filterOptions(value);
|
|
22597
|
+
}
|
|
22598
|
+
});
|
|
22599
|
+
|
|
22600
|
+
this._domElements.input.addEventListener('keydown', function (e) {
|
|
22601
|
+
_this3._handleArrows(e);
|
|
22602
|
+
|
|
22603
|
+
_this3._handleBackspace(e);
|
|
22604
|
+
|
|
22605
|
+
_this3._handleEnter(e);
|
|
22606
|
+
});
|
|
22607
|
+
}
|
|
22608
|
+
/**
|
|
22609
|
+
* Filters user input.
|
|
22610
|
+
* @param { string } value
|
|
22611
|
+
* @private
|
|
22612
|
+
*/
|
|
22613
|
+
|
|
22614
|
+
}, {
|
|
22615
|
+
key: "_filterOptions",
|
|
22616
|
+
value: function _filterOptions(value) {
|
|
22617
|
+
var _this4 = this;
|
|
22618
|
+
|
|
22619
|
+
var isOpen = this._domElements.optionsContainer.classList.contains('visible');
|
|
22620
|
+
|
|
22621
|
+
var valueLowerCase = value.toLowerCase();
|
|
22622
|
+
|
|
22623
|
+
if (!isOpen && value.length > 0) {
|
|
22624
|
+
this._domElements.optionsContainer.classList.add('visible');
|
|
22625
|
+
|
|
22626
|
+
this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
|
|
22627
|
+
}
|
|
22628
|
+
|
|
22629
|
+
if (this._domElements.options.list.length > 0) {
|
|
22630
|
+
for (var i = 0; i < this._domElements.options.list.length; i++) {
|
|
22631
|
+
var el = this._domElements.options.list[i];
|
|
22632
|
+
var text = this._itemTemplate ? this._data[i][this._textField] : el.textContent;
|
|
22633
|
+
|
|
22634
|
+
if (text.toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase) {
|
|
22635
|
+
this._domElements.optionsContainerList.appendChild(el);
|
|
22636
|
+
} else {
|
|
22637
|
+
el.parentNode && el.parentNode.removeChild(el);
|
|
22638
|
+
}
|
|
22639
|
+
}
|
|
22640
|
+
|
|
22641
|
+
var hasResults = this._domElements.options.some(function (el, index) {
|
|
22642
|
+
return (_this4._itemTemplate ? _this4._data[index][_this4._textField] : el.textContent).toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase;
|
|
22643
|
+
});
|
|
22644
|
+
|
|
22645
|
+
this._showNoResults(!hasResults);
|
|
22646
|
+
}
|
|
22647
|
+
}
|
|
22648
|
+
}, {
|
|
22649
|
+
key: "_generateId",
|
|
22650
|
+
value: function _generateId(length) {
|
|
22651
|
+
var result = '';
|
|
22652
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
22653
|
+
var charactersLength = characters.length;
|
|
22654
|
+
|
|
22655
|
+
for (var i = 0; i < length; i++) {
|
|
22656
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
22657
|
+
}
|
|
22658
|
+
|
|
22659
|
+
return result;
|
|
22660
|
+
}
|
|
22661
|
+
/**
|
|
22662
|
+
* Gets data from select tag.
|
|
22663
|
+
* @private
|
|
22664
|
+
*/
|
|
22665
|
+
|
|
22666
|
+
}, {
|
|
22667
|
+
key: "_getDataFromSelectTag",
|
|
22668
|
+
value: function _getDataFromSelectTag() {
|
|
22669
|
+
var arr = [];
|
|
22670
|
+
var options = this._select.options;
|
|
22671
|
+
|
|
22672
|
+
for (var i = 0; i < options.length; i++) {
|
|
22673
|
+
var item = options[i];
|
|
22674
|
+
arr.push({
|
|
22675
|
+
text: item.text,
|
|
22676
|
+
value: item.value,
|
|
22677
|
+
selected: item.hasAttribute('selected')
|
|
22678
|
+
});
|
|
22679
|
+
}
|
|
22680
|
+
|
|
22681
|
+
return arr;
|
|
22682
|
+
}
|
|
22683
|
+
/**
|
|
22684
|
+
* Gets data from settings.
|
|
22685
|
+
* @private
|
|
22686
|
+
*/
|
|
22687
|
+
|
|
22688
|
+
}, {
|
|
22689
|
+
key: "_getDataFromSettings",
|
|
22690
|
+
value: function _getDataFromSettings() {
|
|
22691
|
+
if (this._data.length > 0 && this._valueField && this._textField) {
|
|
22692
|
+
var isValueFieldValid = typeof this._valueField === 'string';
|
|
22693
|
+
var isTextFieldValid = typeof this._textField === 'string';
|
|
22694
|
+
var arr = [];
|
|
22695
|
+
|
|
22696
|
+
if (!isValueFieldValid || !isTextFieldValid) {
|
|
22697
|
+
throw new Error('textField and valueField must be of type string');
|
|
22698
|
+
}
|
|
22699
|
+
|
|
22700
|
+
for (var i = 0; i < this._data.length; i++) {
|
|
22701
|
+
var item = this._data[i];
|
|
22702
|
+
arr.push({
|
|
22703
|
+
value: item[this._valueField],
|
|
22704
|
+
text: item[this._textField],
|
|
22705
|
+
selected: typeof item.selected === 'boolean' ? item.selected : false
|
|
22706
|
+
});
|
|
22707
|
+
}
|
|
22708
|
+
|
|
22709
|
+
return arr;
|
|
22710
|
+
} else {
|
|
22711
|
+
return null;
|
|
22712
|
+
}
|
|
22713
|
+
}
|
|
22714
|
+
/**
|
|
22715
|
+
* Handles Arrow up & Down. Selection of an option is also possible with these keys.
|
|
22716
|
+
* @param { Event } event
|
|
22717
|
+
* @private
|
|
22718
|
+
*/
|
|
22719
|
+
|
|
22720
|
+
}, {
|
|
22721
|
+
key: "_handleArrows",
|
|
22722
|
+
value: function _handleArrows(event) {
|
|
22723
|
+
if (event.keyCode === 40 || event.keyCode === 38) {
|
|
22724
|
+
event.preventDefault();
|
|
22725
|
+
|
|
22726
|
+
var isOpen = this._domElements.optionsContainer.classList.contains('visible'); // An updated view of the container is needed because of the filtering option
|
|
22727
|
+
|
|
22728
|
+
|
|
22729
|
+
var optionsContainerList = this._multiselect.querySelector('.multiselect__options > ul');
|
|
22730
|
+
|
|
22731
|
+
if (!isOpen) {
|
|
22732
|
+
this._domElements.optionsContainer.classList.add('visible');
|
|
22733
|
+
|
|
22734
|
+
this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
|
|
22735
|
+
|
|
22736
|
+
optionsContainerList.firstElementChild.classList.add('arrow-selected');
|
|
22737
|
+
optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
|
|
22738
|
+
optionsContainerList.firstElementChild.scrollIntoView(false);
|
|
22739
|
+
} else {
|
|
22740
|
+
var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
|
|
22741
|
+
|
|
22742
|
+
var action = {
|
|
22743
|
+
ArrowUp: 'previous',
|
|
22744
|
+
Up: 'previous',
|
|
22745
|
+
ArrowDown: 'next',
|
|
22746
|
+
Down: 'next'
|
|
22747
|
+
};
|
|
22748
|
+
|
|
22749
|
+
if (!selected) {
|
|
22750
|
+
optionsContainerList.firstElementChild.classList.add('arrow-selected');
|
|
22751
|
+
optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
|
|
22752
|
+
optionsContainerList.firstElementChild.scrollIntoView(false);
|
|
22753
|
+
return;
|
|
22754
|
+
}
|
|
22755
|
+
|
|
22756
|
+
selected.classList.remove('arrow-selected');
|
|
22757
|
+
selected.setAttribute('style', style.multiselect__options_ul_li);
|
|
22758
|
+
selected = selected[action[event.key] + 'ElementSibling']; // Go to start or end of the popup list
|
|
22759
|
+
|
|
22760
|
+
if (!selected) {
|
|
22761
|
+
selected = optionsContainerList.children[action[event.key] === 'next' ? 0 : optionsContainerList.children.length - 1];
|
|
22762
|
+
selected.classList.add('arrow-selected');
|
|
22763
|
+
selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
|
|
22764
|
+
|
|
22765
|
+
this._scrollIntoView(optionsContainerList, selected);
|
|
22766
|
+
|
|
22767
|
+
return;
|
|
22768
|
+
}
|
|
22769
|
+
|
|
22770
|
+
selected.classList.add('arrow-selected');
|
|
22771
|
+
selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
|
|
22772
|
+
|
|
22773
|
+
this._scrollIntoView(optionsContainerList, selected);
|
|
22774
|
+
}
|
|
22775
|
+
}
|
|
22776
|
+
}
|
|
22777
|
+
/**
|
|
22778
|
+
* Handles the backspace key event - Deletes the preceding option in the selection list.
|
|
22779
|
+
* @param { Event } e
|
|
22780
|
+
* @private
|
|
22781
|
+
*/
|
|
22782
|
+
|
|
22783
|
+
}, {
|
|
22784
|
+
key: "_handleBackspace",
|
|
22785
|
+
value: function _handleBackspace(e) {
|
|
22786
|
+
if (e.keyCode === 8 && e.target.value === '') {
|
|
22787
|
+
var lastSelectedOption = this._selectedOptions.length > 0 ? this._selectedOptions[this._selectedOptions.length - 1] : null;
|
|
22788
|
+
|
|
22789
|
+
if (lastSelectedOption) {
|
|
22790
|
+
var targetLastSelectedOption = this._multiselect.querySelector("li[data-value=\"".concat(lastSelectedOption.value, "\"]"));
|
|
22791
|
+
|
|
22792
|
+
this._handleOption(targetLastSelectedOption);
|
|
22793
|
+
|
|
22794
|
+
if (this._selectedOptions.length === 0) {
|
|
22795
|
+
this._domElements.optionsContainer.classList.remove('visible');
|
|
22796
|
+
|
|
22797
|
+
this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
|
|
22798
|
+
}
|
|
22799
|
+
}
|
|
22800
|
+
}
|
|
22801
|
+
}
|
|
22802
|
+
/**
|
|
22803
|
+
* Shows clear selection button if some options are selected.
|
|
22804
|
+
* @private
|
|
22805
|
+
*/
|
|
22806
|
+
|
|
22807
|
+
}, {
|
|
22808
|
+
key: "_handleClearSelectionBtn",
|
|
22809
|
+
value: function _handleClearSelectionBtn() {
|
|
22810
|
+
if (this._selectedOptions.length > 0) {
|
|
22811
|
+
this._domElements.clear.style.display = 'flex';
|
|
22812
|
+
} else {
|
|
22813
|
+
this._domElements.clear.style.display = 'none';
|
|
22814
|
+
}
|
|
22815
|
+
}
|
|
22816
|
+
/**
|
|
22817
|
+
* Handles the enter key event.
|
|
22818
|
+
* @param { Event } event
|
|
22819
|
+
* @private
|
|
22820
|
+
*/
|
|
22821
|
+
|
|
22822
|
+
}, {
|
|
22823
|
+
key: "_handleEnter",
|
|
22824
|
+
value: function _handleEnter(event) {
|
|
22825
|
+
if (event.keyCode === 13) {
|
|
22826
|
+
var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
|
|
22827
|
+
|
|
22828
|
+
if (selected) {
|
|
22829
|
+
this._handleOption(selected);
|
|
22830
|
+
|
|
22831
|
+
this._closeList();
|
|
22832
|
+
}
|
|
22833
|
+
}
|
|
22834
|
+
}
|
|
22835
|
+
}, {
|
|
22836
|
+
key: "_handleOption",
|
|
22837
|
+
value: function _handleOption(target) {
|
|
22838
|
+
var dispatchEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
22839
|
+
|
|
22840
|
+
// Remove
|
|
22841
|
+
for (var i = 0; i < this._selectedOptions.length; i++) {
|
|
22842
|
+
var el = this._selectedOptions[i];
|
|
22843
|
+
|
|
22844
|
+
if (el.value === target.dataset.value) {
|
|
22845
|
+
target.classList.remove('multiselect__options--selected');
|
|
22846
|
+
target.setAttribute('style', style.multiselect__options);
|
|
22847
|
+
|
|
22848
|
+
this._selectedOptions.splice(i, 1);
|
|
22849
|
+
|
|
22850
|
+
this._removeOptionFromList(target.dataset.value);
|
|
22851
|
+
|
|
22852
|
+
this._handleClearSelectionBtn();
|
|
22853
|
+
|
|
22854
|
+
this._handlePlaceholder();
|
|
22855
|
+
|
|
22856
|
+
return dispatchEvent && this._dispatchEvent({
|
|
22857
|
+
action: 'REMOVE_OPTION',
|
|
22858
|
+
value: target.dataset.value,
|
|
22859
|
+
selection: this._selectedOptions
|
|
22860
|
+
});
|
|
22861
|
+
}
|
|
22862
|
+
} // Add
|
|
22863
|
+
|
|
22864
|
+
|
|
22865
|
+
for (var _i = 0; _i < this._options.length; _i++) {
|
|
22866
|
+
var option = this._options[_i];
|
|
22867
|
+
|
|
22868
|
+
if (option.value === target.dataset.value) {
|
|
22869
|
+
target.classList.add('multiselect__options--selected');
|
|
22870
|
+
target.setAttribute('style', style.multiselect__options_selected);
|
|
22871
|
+
this._selectedOptions = [].concat((0, _toConsumableArray2["default"])(this._selectedOptions), [option]);
|
|
22872
|
+
|
|
22873
|
+
this._addOptionToList(option, _i);
|
|
22874
|
+
|
|
22875
|
+
this._handleClearSelectionBtn();
|
|
22876
|
+
|
|
22877
|
+
this._handlePlaceholder();
|
|
22878
|
+
|
|
22879
|
+
return dispatchEvent && this._dispatchEvent({
|
|
22880
|
+
action: 'ADD_OPTION',
|
|
22881
|
+
value: target.dataset.value,
|
|
22882
|
+
selection: this._selectedOptions
|
|
22883
|
+
});
|
|
22884
|
+
}
|
|
22885
|
+
}
|
|
22886
|
+
}
|
|
22887
|
+
/**
|
|
22888
|
+
* Shows the placeholder if no options are selected.
|
|
22889
|
+
* @private
|
|
22890
|
+
*/
|
|
22891
|
+
|
|
22892
|
+
}, {
|
|
22893
|
+
key: "_handlePlaceholder",
|
|
22894
|
+
value: function _handlePlaceholder() {
|
|
22895
|
+
this._domElements.input.placeholder = this._placeholder;
|
|
22896
|
+
}
|
|
22897
|
+
}, {
|
|
22898
|
+
key: "_initSelectedList",
|
|
22899
|
+
value: function _initSelectedList() {
|
|
22900
|
+
var _this5 = this;
|
|
22901
|
+
|
|
22902
|
+
var hasItemsSelected = false;
|
|
22903
|
+
|
|
22904
|
+
var _loop2 = function _loop2(i) {
|
|
22905
|
+
var option = _this5._options[i];
|
|
22906
|
+
|
|
22907
|
+
if (option.selected) {
|
|
22908
|
+
hasItemsSelected = true;
|
|
22909
|
+
|
|
22910
|
+
var target = _this5._domElements.options.find(function (el) {
|
|
22911
|
+
return el.dataset.value === option.value;
|
|
22912
|
+
});
|
|
22913
|
+
|
|
22914
|
+
target.classList.add('multiselect__options--selected');
|
|
22915
|
+
target.setAttribute('style', style.multiselect__options_selected);
|
|
22916
|
+
_this5._selectedOptions = [].concat((0, _toConsumableArray2["default"])(_this5._selectedOptions), [option]);
|
|
22917
|
+
|
|
22918
|
+
_this5._addOptionToList(option, i);
|
|
22919
|
+
}
|
|
22920
|
+
};
|
|
22921
|
+
|
|
22922
|
+
for (var i = 0; i < this._options.length; i++) {
|
|
22923
|
+
_loop2(i);
|
|
22924
|
+
}
|
|
22925
|
+
|
|
22926
|
+
if (hasItemsSelected) {
|
|
22927
|
+
this._handleClearSelectionBtn();
|
|
22928
|
+
}
|
|
22929
|
+
|
|
22930
|
+
this._handlePlaceholder();
|
|
22931
|
+
}
|
|
22932
|
+
/**
|
|
22933
|
+
* Process the custom template.
|
|
22934
|
+
* @param { string } template
|
|
22935
|
+
* @private
|
|
22936
|
+
*/
|
|
22937
|
+
|
|
22938
|
+
}, {
|
|
22939
|
+
key: "_processTemplate",
|
|
22940
|
+
value: function _processTemplate(template, index) {
|
|
22941
|
+
var processedTemplate = template;
|
|
22942
|
+
var objAttr = template.match(/\$\{(\w+)\}/g).map(function (e) {
|
|
22943
|
+
return e.replace(/\$\{|\}/g, '');
|
|
22944
|
+
});
|
|
22945
|
+
|
|
22946
|
+
for (var i = 0; i < objAttr.length; i++) {
|
|
22947
|
+
var _this$_data$index$att;
|
|
22948
|
+
|
|
22949
|
+
var attr = objAttr[i]; // eslint-disable-next-line no-useless-escape
|
|
22950
|
+
|
|
22951
|
+
processedTemplate = processedTemplate.replace("${".concat(attr, "}"), (_this$_data$index$att = this._data[index][attr]) !== null && _this$_data$index$att !== void 0 ? _this$_data$index$att : '');
|
|
22952
|
+
}
|
|
22953
|
+
|
|
22954
|
+
return processedTemplate;
|
|
22955
|
+
}
|
|
22956
|
+
}, {
|
|
22957
|
+
key: "_removeAllArrowSelected",
|
|
22958
|
+
value: function _removeAllArrowSelected() {
|
|
22959
|
+
var className = 'arrow-selected';
|
|
22960
|
+
|
|
22961
|
+
var target = this._domElements.options.find(function (el) {
|
|
22962
|
+
return el.classList.contains(className);
|
|
22963
|
+
});
|
|
22964
|
+
|
|
22965
|
+
target && target.classList.remove(className) && target.setAttribute('style', style.multiselect__options_ul_li);
|
|
22966
|
+
}
|
|
22967
|
+
/**
|
|
22968
|
+
* Removes an option from the list.
|
|
22969
|
+
* @param { string } value
|
|
22970
|
+
* @private
|
|
22971
|
+
*/
|
|
22972
|
+
|
|
22973
|
+
}, {
|
|
22974
|
+
key: "_removeOptionFromList",
|
|
22975
|
+
value: function _removeOptionFromList(value) {
|
|
22976
|
+
var optionDom = this._multiselect.querySelector("span[data-value=\"".concat(value, "\"]"));
|
|
22977
|
+
|
|
22978
|
+
optionDom && optionDom.parentNode && optionDom.parentNode.removeChild(optionDom);
|
|
22979
|
+
}
|
|
22980
|
+
/**
|
|
22981
|
+
* Renders the multiselect options list view.
|
|
22982
|
+
* @private
|
|
22983
|
+
*/
|
|
22984
|
+
|
|
22985
|
+
}, {
|
|
22986
|
+
key: "_renderOptionsList",
|
|
22987
|
+
value: function _renderOptionsList() {
|
|
22988
|
+
var _this6 = this;
|
|
22989
|
+
|
|
22990
|
+
var html = "\n <div class=\"multiselect__options\" style=\"".concat(style.multiselect__options, "\">\n <ul style=\"").concat(style.multiselect__options_ul, "\">\n ").concat(this._options.length > 0 && !this._itemTemplate ? this._options.map(function (option) {
|
|
22991
|
+
return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(option.text, "</li>\n ");
|
|
22992
|
+
}).join('') : '', "\n\n ").concat(this._options.length > 0 && this._itemTemplate ? this._options.map(function (option, index) {
|
|
22993
|
+
return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(_this6._processTemplate(_this6._itemTemplate, index), "</li>\n ");
|
|
22994
|
+
}).join('') : '', "\n ").concat(this._showNoData(this._options.length === 0), "\n </ul>\n </div>\n ");
|
|
22995
|
+
|
|
22996
|
+
this._multiselect.insertAdjacentHTML('beforeend', html);
|
|
22997
|
+
}
|
|
22998
|
+
/**
|
|
22999
|
+
* Renders the multiselect view.
|
|
23000
|
+
* @private
|
|
23001
|
+
*/
|
|
23002
|
+
|
|
23003
|
+
}, {
|
|
23004
|
+
key: "_renderMultiselect",
|
|
23005
|
+
value: function _renderMultiselect() {
|
|
23006
|
+
this._select.style.display = 'none';
|
|
23007
|
+
|
|
23008
|
+
var id = 'iconic-' + this._generateId(20); // Timea created dedicated div element because previous code was not rendering
|
|
23009
|
+
|
|
23010
|
+
|
|
23011
|
+
this._multiselect = document.createElement('div');
|
|
23012
|
+
|
|
23013
|
+
this._multiselect.setAttribute('id', id);
|
|
23014
|
+
|
|
23015
|
+
this._multiselect.setAttribute('class', 'multiselect__container');
|
|
23016
|
+
|
|
23017
|
+
this._multiselect.setAttribute('style', style.multiselect__container);
|
|
23018
|
+
|
|
23019
|
+
var html = "\n <div class=\"multiselect__wrapper\" style=\"".concat(style.multiselect__wrapper, "\">\n <input class=\"multiselect__input\" style=\"").concat(style.multiselect__input, "\" placeholder=\"").concat(this._placeholder, "\" />\n </div>\n <span style=\"display: none;\" class=\"multiselect__clear-btn\" style=\"").concat(style.multiselect__clear_btn, "\">").concat(this._cross, "</span>\n ");
|
|
23020
|
+
this._multiselect.innerHTML = html;
|
|
23021
|
+
|
|
23022
|
+
this._selectContainer.appendChild(this._multiselect);
|
|
23023
|
+
}
|
|
23024
|
+
/**
|
|
23025
|
+
* ScrollIntoView - This small utility reproduces the behavior of .scrollIntoView({ block: "nearest", inline: "nearest" })
|
|
23026
|
+
* This is for IE compatibility without a need of a polyfill
|
|
23027
|
+
* @private
|
|
23028
|
+
*/
|
|
23029
|
+
|
|
23030
|
+
}, {
|
|
23031
|
+
key: "_scrollIntoView",
|
|
23032
|
+
value: function _scrollIntoView(parent, child) {
|
|
23033
|
+
var rectParent = parent.getBoundingClientRect();
|
|
23034
|
+
var rectChild = child.getBoundingClientRect(); // Detect if not visible at top and then scroll to the top
|
|
23035
|
+
|
|
23036
|
+
if (!(rectParent.top < rectChild.bottom - child.offsetHeight)) {
|
|
23037
|
+
parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight);
|
|
23038
|
+
} // Detect if not visible at bottom and then scroll to the bottom
|
|
23039
|
+
|
|
23040
|
+
|
|
23041
|
+
if (!(rectParent.bottom > rectChild.top + child.offsetHeight)) {
|
|
23042
|
+
parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight) - (parent.offsetHeight - (child.offsetHeight + (child.offsetHeight - child.clientHeight)));
|
|
23043
|
+
}
|
|
23044
|
+
}
|
|
23045
|
+
/**
|
|
23046
|
+
* Shows a no data message.
|
|
23047
|
+
* @param { boolean } condition
|
|
23048
|
+
* @private
|
|
23049
|
+
*/
|
|
23050
|
+
|
|
23051
|
+
}, {
|
|
23052
|
+
key: "_showNoData",
|
|
23053
|
+
value: function _showNoData(condition) {
|
|
23054
|
+
return condition ? "<p class=\"multiselect__options--no-data\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_data, "\">").concat(this._noData, "</p>") : '';
|
|
23055
|
+
}
|
|
23056
|
+
/**
|
|
23057
|
+
* Shows a no results message.
|
|
23058
|
+
* @param { boolean } condition
|
|
23059
|
+
* @private
|
|
23060
|
+
*/
|
|
23061
|
+
|
|
23062
|
+
}, {
|
|
23063
|
+
key: "_showNoResults",
|
|
23064
|
+
value: function _showNoResults(condition) {
|
|
23065
|
+
var dom = this._multiselect.querySelector('.multiselect__options--no-results');
|
|
23066
|
+
|
|
23067
|
+
if (condition) {
|
|
23068
|
+
var html = "<p class=\"multiselect__options--no-results\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_results, "\">").concat(this._noResults, "</p>");
|
|
23069
|
+
!dom && this._domElements.optionsContainerList.insertAdjacentHTML('beforeend', html);
|
|
23070
|
+
} else {
|
|
23071
|
+
dom && dom.parentNode && dom.parentNode.removeChild(dom);
|
|
23072
|
+
}
|
|
23073
|
+
}
|
|
23074
|
+
}]);
|
|
23075
|
+
return IconicMultiSelect;
|
|
23076
|
+
}();
|
|
23077
|
+
|
|
23078
|
+
exports.IconicMultiSelect = IconicMultiSelect;
|
|
23079
|
+
//# sourceMappingURL=multiSelect.js.map
|
|
23080
|
+
|
|
23081
|
+
/***/ }),
|
|
23082
|
+
|
|
21970
23083
|
/***/ "./lib/widgets/peoplePicker.js":
|
|
21971
23084
|
/*!*************************************!*\
|
|
21972
23085
|
!*** ./lib/widgets/peoplePicker.js ***!
|
|
@@ -22638,6 +23751,22 @@ module.exports = _arrayWithHoles, module.exports.__esModule = true, module.expor
|
|
|
22638
23751
|
|
|
22639
23752
|
/***/ }),
|
|
22640
23753
|
|
|
23754
|
+
/***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js":
|
|
23755
|
+
/*!******************************************************************!*\
|
|
23756
|
+
!*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
|
|
23757
|
+
\******************************************************************/
|
|
23758
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
23759
|
+
|
|
23760
|
+
var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
|
|
23761
|
+
|
|
23762
|
+
function _arrayWithoutHoles(arr) {
|
|
23763
|
+
if (Array.isArray(arr)) return arrayLikeToArray(arr);
|
|
23764
|
+
}
|
|
23765
|
+
|
|
23766
|
+
module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
23767
|
+
|
|
23768
|
+
/***/ }),
|
|
23769
|
+
|
|
22641
23770
|
/***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js":
|
|
22642
23771
|
/*!**********************************************************************!*\
|
|
22643
23772
|
!*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
|
|
@@ -22903,6 +24032,20 @@ module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, mo
|
|
|
22903
24032
|
|
|
22904
24033
|
/***/ }),
|
|
22905
24034
|
|
|
24035
|
+
/***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js":
|
|
24036
|
+
/*!****************************************************************!*\
|
|
24037
|
+
!*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
|
|
24038
|
+
\****************************************************************/
|
|
24039
|
+
/***/ ((module) => {
|
|
24040
|
+
|
|
24041
|
+
function _iterableToArray(iter) {
|
|
24042
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
24043
|
+
}
|
|
24044
|
+
|
|
24045
|
+
module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
24046
|
+
|
|
24047
|
+
/***/ }),
|
|
24048
|
+
|
|
22906
24049
|
/***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
|
|
22907
24050
|
/*!*********************************************************************!*\
|
|
22908
24051
|
!*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
|
|
@@ -22957,6 +24100,20 @@ module.exports = _nonIterableRest, module.exports.__esModule = true, module.expo
|
|
|
22957
24100
|
|
|
22958
24101
|
/***/ }),
|
|
22959
24102
|
|
|
24103
|
+
/***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js":
|
|
24104
|
+
/*!******************************************************************!*\
|
|
24105
|
+
!*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
|
|
24106
|
+
\******************************************************************/
|
|
24107
|
+
/***/ ((module) => {
|
|
24108
|
+
|
|
24109
|
+
function _nonIterableSpread() {
|
|
24110
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
24111
|
+
}
|
|
24112
|
+
|
|
24113
|
+
module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
24114
|
+
|
|
24115
|
+
/***/ }),
|
|
24116
|
+
|
|
22960
24117
|
/***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
|
|
22961
24118
|
/*!**************************************************************************!*\
|
|
22962
24119
|
!*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
|
|
@@ -23043,6 +24200,28 @@ module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, modul
|
|
|
23043
24200
|
|
|
23044
24201
|
/***/ }),
|
|
23045
24202
|
|
|
24203
|
+
/***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js":
|
|
24204
|
+
/*!******************************************************************!*\
|
|
24205
|
+
!*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
|
|
24206
|
+
\******************************************************************/
|
|
24207
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
24208
|
+
|
|
24209
|
+
var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js");
|
|
24210
|
+
|
|
24211
|
+
var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/iterableToArray.js");
|
|
24212
|
+
|
|
24213
|
+
var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
|
|
24214
|
+
|
|
24215
|
+
var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js");
|
|
24216
|
+
|
|
24217
|
+
function _toConsumableArray(arr) {
|
|
24218
|
+
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
|
|
24219
|
+
}
|
|
24220
|
+
|
|
24221
|
+
module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
24222
|
+
|
|
24223
|
+
/***/ }),
|
|
24224
|
+
|
|
23046
24225
|
/***/ "./node_modules/@babel/runtime/helpers/typeof.js":
|
|
23047
24226
|
/*!*******************************************************!*\
|
|
23048
24227
|
!*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
|
|
@@ -44570,8 +45749,8 @@ class N3Parser {
|
|
|
44570
45749
|
_saveContext(type, graph, subject, predicate, object) {
|
|
44571
45750
|
const n3Mode = this._n3Mode;
|
|
44572
45751
|
this._contextStack.push({
|
|
44573
|
-
|
|
44574
|
-
|
|
45752
|
+
type,
|
|
45753
|
+
subject, predicate, object, graph,
|
|
44575
45754
|
inverse: n3Mode ? this._inversePredicate : false,
|
|
44576
45755
|
blankPrefix: n3Mode ? this._prefixes._ : '',
|
|
44577
45756
|
quantified: n3Mode ? this._quantified : null,
|
|
@@ -44590,14 +45769,20 @@ class N3Parser {
|
|
|
44590
45769
|
|
|
44591
45770
|
// ### `_restoreContext` restores the parent context
|
|
44592
45771
|
// when leaving a scope (list, blank node, formula)
|
|
44593
|
-
_restoreContext() {
|
|
44594
|
-
|
|
45772
|
+
_restoreContext(type, token) {
|
|
45773
|
+
// Obtain the previous context
|
|
45774
|
+
const context = this._contextStack.pop();
|
|
45775
|
+
if (!context || context.type !== type)
|
|
45776
|
+
return this._error(`Unexpected ${token.type}`, token);
|
|
45777
|
+
|
|
45778
|
+
// Restore the quad of the previous context
|
|
44595
45779
|
this._subject = context.subject;
|
|
44596
45780
|
this._predicate = context.predicate;
|
|
44597
45781
|
this._object = context.object;
|
|
44598
45782
|
this._graph = context.graph;
|
|
44599
|
-
|
|
44600
|
-
|
|
45783
|
+
|
|
45784
|
+
// Restore N3 context settings
|
|
45785
|
+
if (this._n3Mode) {
|
|
44601
45786
|
this._inversePredicate = context.inverse;
|
|
44602
45787
|
this._prefixes._ = context.blankPrefix;
|
|
44603
45788
|
this._quantified = context.quantified;
|
|
@@ -44870,7 +46055,7 @@ class N3Parser {
|
|
|
44870
46055
|
|
|
44871
46056
|
// Restore the parent context containing this blank node
|
|
44872
46057
|
const empty = this._predicate === null;
|
|
44873
|
-
this._restoreContext();
|
|
46058
|
+
this._restoreContext('blank', token);
|
|
44874
46059
|
// If the blank node was the object, restore previous context and read punctuation
|
|
44875
46060
|
if (this._object !== null)
|
|
44876
46061
|
return this._getContextEndReader();
|
|
@@ -44921,7 +46106,7 @@ class N3Parser {
|
|
|
44921
46106
|
break;
|
|
44922
46107
|
case ')':
|
|
44923
46108
|
// Closing the list; restore the parent context
|
|
44924
|
-
this._restoreContext();
|
|
46109
|
+
this._restoreContext('list', token);
|
|
44925
46110
|
// If this list is contained within a parent list, return the membership quad here.
|
|
44926
46111
|
// This will be `<parent list element> rdf:first <this list>.`.
|
|
44927
46112
|
if (stack.length !== 0 && stack[stack.length - 1].type === 'list')
|
|
@@ -45072,7 +46257,7 @@ class N3Parser {
|
|
|
45072
46257
|
this._emit(this._subject, this._predicate, this._object, this._graph);
|
|
45073
46258
|
|
|
45074
46259
|
// Restore the parent context containing this formula
|
|
45075
|
-
this._restoreContext();
|
|
46260
|
+
this._restoreContext('formula', token);
|
|
45076
46261
|
// If the formula was the subject, continue reading the predicate.
|
|
45077
46262
|
// If the formula was the object, read punctuation.
|
|
45078
46263
|
return this._object === null ? this._readPredicate : this._getContextEndReader();
|
|
@@ -45281,7 +46466,7 @@ class N3Parser {
|
|
|
45281
46466
|
// The list item is the remaining subejct after reading the path
|
|
45282
46467
|
const item = this._subject;
|
|
45283
46468
|
// Switch back to the context of the list
|
|
45284
|
-
this._restoreContext();
|
|
46469
|
+
this._restoreContext('item', token);
|
|
45285
46470
|
// Output the list item
|
|
45286
46471
|
this._emit(this._subject, this.RDF_FIRST, item, this._graph);
|
|
45287
46472
|
}
|
|
@@ -45343,7 +46528,7 @@ class N3Parser {
|
|
|
45343
46528
|
// Read the quad and restore the previous context
|
|
45344
46529
|
const quad = this._quad(this._subject, this._predicate, this._object,
|
|
45345
46530
|
this._graph || this.DEFAULTGRAPH);
|
|
45346
|
-
this._restoreContext();
|
|
46531
|
+
this._restoreContext('<<', token);
|
|
45347
46532
|
// If the triple was the subject, continue by reading the predicate.
|
|
45348
46533
|
if (this._subject === null) {
|
|
45349
46534
|
this._subject = quad;
|
|
@@ -65607,7 +66792,7 @@ var SolidAuthnLogic = /** @class */ (function () {
|
|
|
65607
66792
|
if (app.viewingNoAuthPage) {
|
|
65608
66793
|
return (0, rdflib_1.sym)(app.webId);
|
|
65609
66794
|
}
|
|
65610
|
-
if (this.session.info.webId && this.session.info.isLoggedIn) {
|
|
66795
|
+
if (this && this.session && this.session.info && this.session.info.webId && this.session.info.isLoggedIn) {
|
|
65611
66796
|
return (0, rdflib_1.sym)(this.session.info.webId);
|
|
65612
66797
|
}
|
|
65613
66798
|
return (0, authUtil_1.offlineTestID)(); // null unless testing
|
|
@@ -65797,7 +66982,7 @@ function offlineTestID() {
|
|
|
65797
66982
|
return (0, rdflib_1.sym)($SolidTestEnvironment.username);
|
|
65798
66983
|
}
|
|
65799
66984
|
// hack that makes SolidOS work in offline mode by adding the webId directly in html
|
|
65800
|
-
// example usage: https://github.com/
|
|
66985
|
+
// example usage: https://github.com/solidos/mashlib/blob/29b8b53c46bf02e0e219f0bacd51b0e9951001dd/test/contact/local.html#L37
|
|
65801
66986
|
if (typeof document !== 'undefined' &&
|
|
65802
66987
|
document.location &&
|
|
65803
66988
|
('' + document.location).slice(0, 16) === 'http://localhost') {
|
|
@@ -66134,6 +67319,29 @@ exports.determineChatContainer = determineChatContainer;
|
|
|
66134
67319
|
|
|
66135
67320
|
"use strict";
|
|
66136
67321
|
|
|
67322
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
67323
|
+
if (k2 === undefined) k2 = k;
|
|
67324
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
67325
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
67326
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
67327
|
+
}
|
|
67328
|
+
Object.defineProperty(o, k2, desc);
|
|
67329
|
+
}) : (function(o, m, k, k2) {
|
|
67330
|
+
if (k2 === undefined) k2 = k;
|
|
67331
|
+
o[k2] = m[k];
|
|
67332
|
+
}));
|
|
67333
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
67334
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
67335
|
+
}) : function(o, v) {
|
|
67336
|
+
o["default"] = v;
|
|
67337
|
+
});
|
|
67338
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
67339
|
+
if (mod && mod.__esModule) return mod;
|
|
67340
|
+
var result = {};
|
|
67341
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
67342
|
+
__setModuleDefault(result, mod);
|
|
67343
|
+
return result;
|
|
67344
|
+
};
|
|
66137
67345
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
66138
67346
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
66139
67347
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -66170,16 +67378,128 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
66170
67378
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66171
67379
|
}
|
|
66172
67380
|
};
|
|
67381
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
67382
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
67383
|
+
};
|
|
66173
67384
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
66174
|
-
exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = void 0;
|
|
67385
|
+
exports.deleteTypeIndexRegistration = exports.registerInstanceInTypeIndex = exports.getAppInstances = exports.getScopedAppInstances = exports.getScopedAppsFromIndex = exports.uniqueNodes = exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = exports.followOrCreateLink = exports.suggestPrivateTypeIndex = exports.suggestPublicTypeIndex = exports.suggestPreferencesFile = exports.loadOrCreateIfNotExists = void 0;
|
|
66175
67386
|
var rdflib_1 = __webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js");
|
|
66176
|
-
var
|
|
66177
|
-
|
|
66178
|
-
|
|
66179
|
-
|
|
67387
|
+
var $rdf = __importStar(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
|
|
67388
|
+
var solidLogicSingleton_1 = __webpack_require__(/*! ../logic/solidLogicSingleton */ "./node_modules/solid-logic/lib/logic/solidLogicSingleton.js");
|
|
67389
|
+
var uri_1 = __webpack_require__(/*! ../util/uri */ "./node_modules/solid-logic/lib/util/uri.js");
|
|
67390
|
+
var solid_namespace_1 = __importDefault(__webpack_require__(/*! solid-namespace */ "./node_modules/solid-namespace/index.js"));
|
|
67391
|
+
var authn = solidLogicSingleton_1.solidLogicSingleton.authn;
|
|
67392
|
+
var currentUser = authn.currentUser;
|
|
67393
|
+
var ns = (0, solid_namespace_1.default)($rdf);
|
|
67394
|
+
/**
|
|
67395
|
+
* Create a resource if it really does not exist
|
|
67396
|
+
* Be absolutely sure something does not exist before creating a new empty file
|
|
67397
|
+
* as otherwise existing could be deleted.
|
|
67398
|
+
* @param doc {NamedNode} - The resource
|
|
67399
|
+
*/
|
|
67400
|
+
function loadOrCreateIfNotExists(store, doc) {
|
|
67401
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67402
|
+
var response, err_1, msg, msg;
|
|
67403
|
+
return __generator(this, function (_a) {
|
|
67404
|
+
switch (_a.label) {
|
|
67405
|
+
case 0:
|
|
67406
|
+
_a.trys.push([0, 2, , 3]);
|
|
67407
|
+
return [4 /*yield*/, store.fetcher.load(doc)];
|
|
67408
|
+
case 1:
|
|
67409
|
+
response = _a.sent();
|
|
67410
|
+
return [3 /*break*/, 3];
|
|
67411
|
+
case 2:
|
|
67412
|
+
err_1 = _a.sent();
|
|
67413
|
+
if (err_1.response.status === 404) {
|
|
67414
|
+
try {
|
|
67415
|
+
store.fetcher.webOperation('PUT', doc, { data: '', contentType: 'text/turtle' });
|
|
67416
|
+
}
|
|
67417
|
+
catch (err) {
|
|
67418
|
+
msg = 'createIfNotExists: PUT FAILED: ' + doc + ': ' + err;
|
|
67419
|
+
throw new Error(msg);
|
|
67420
|
+
}
|
|
67421
|
+
delete store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
67422
|
+
}
|
|
67423
|
+
else {
|
|
67424
|
+
msg = 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err_1;
|
|
67425
|
+
throw new Error(msg); // @@ add nested errors
|
|
67426
|
+
}
|
|
67427
|
+
return [3 /*break*/, 3];
|
|
67428
|
+
case 3: return [2 /*return*/, response];
|
|
67429
|
+
}
|
|
67430
|
+
});
|
|
67431
|
+
});
|
|
67432
|
+
}
|
|
67433
|
+
exports.loadOrCreateIfNotExists = loadOrCreateIfNotExists;
|
|
67434
|
+
function suggestPreferencesFile(me) {
|
|
67435
|
+
var stripped = me.uri.replace('/profile/', '/').replace('/public/', '/');
|
|
67436
|
+
// const stripped = me.uri.replace(\/[p|P]rofile/\g, '/').replace(\/[p|P]ublic/\g, '/')
|
|
67437
|
+
var folderURI = stripped.split('/').slice(0, -1).join('/') + '/Settings/';
|
|
67438
|
+
var fileURI = folderURI + 'Preferences.ttl';
|
|
67439
|
+
return (0, rdflib_1.sym)(fileURI);
|
|
67440
|
+
}
|
|
67441
|
+
exports.suggestPreferencesFile = suggestPreferencesFile;
|
|
67442
|
+
function suggestPublicTypeIndex(me) {
|
|
67443
|
+
var _a;
|
|
67444
|
+
return (0, rdflib_1.sym)(((_a = me.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'publicTypeIndex.ttl');
|
|
67445
|
+
}
|
|
67446
|
+
exports.suggestPublicTypeIndex = suggestPublicTypeIndex;
|
|
67447
|
+
// Note this one is based off the pref file not the profile
|
|
67448
|
+
function suggestPrivateTypeIndex(preferencesFile) {
|
|
67449
|
+
var _a;
|
|
67450
|
+
return (0, rdflib_1.sym)(((_a = preferencesFile.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'privateTypeIndex.ttl');
|
|
67451
|
+
}
|
|
67452
|
+
exports.suggestPrivateTypeIndex = suggestPrivateTypeIndex;
|
|
67453
|
+
/* Follow link from this doc to another thing, or else make a new link
|
|
67454
|
+
**
|
|
67455
|
+
** return: null no ld one and failed to make a new one
|
|
67456
|
+
*/
|
|
67457
|
+
function followOrCreateLink(store, subject, predicate, object, doc) {
|
|
67458
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67459
|
+
var result, err_2, err_3;
|
|
67460
|
+
return __generator(this, function (_a) {
|
|
67461
|
+
switch (_a.label) {
|
|
67462
|
+
case 0: return [4 /*yield*/, store.fetcher.load(doc)];
|
|
67463
|
+
case 1:
|
|
67464
|
+
_a.sent();
|
|
67465
|
+
result = store.any(subject, predicate, null, doc);
|
|
67466
|
+
if (result)
|
|
67467
|
+
return [2 /*return*/, result];
|
|
67468
|
+
if (!store.updater.editable(doc)) {
|
|
67469
|
+
return [2 /*return*/, null];
|
|
67470
|
+
}
|
|
67471
|
+
_a.label = 2;
|
|
67472
|
+
case 2:
|
|
67473
|
+
_a.trys.push([2, 4, , 5]);
|
|
67474
|
+
return [4 /*yield*/, store.updater.update([], [(0, rdflib_1.st)(subject, predicate, object, doc)])];
|
|
67475
|
+
case 3:
|
|
67476
|
+
_a.sent();
|
|
67477
|
+
return [3 /*break*/, 5];
|
|
67478
|
+
case 4:
|
|
67479
|
+
err_2 = _a.sent();
|
|
67480
|
+
console.warn("followOrCreateLink: Error making link in ".concat(doc, " to ").concat(object, ": ").concat(err_2));
|
|
67481
|
+
return [2 /*return*/, null];
|
|
67482
|
+
case 5:
|
|
67483
|
+
_a.trys.push([5, 7, , 8]);
|
|
67484
|
+
return [4 /*yield*/, loadOrCreateIfNotExists(store, object)
|
|
67485
|
+
// store.fetcher.webOperation('PUT', object, { data: '', contentType: 'text/turtle'})
|
|
67486
|
+
];
|
|
67487
|
+
case 6:
|
|
67488
|
+
_a.sent();
|
|
67489
|
+
return [3 /*break*/, 8];
|
|
67490
|
+
case 7:
|
|
67491
|
+
err_3 = _a.sent();
|
|
67492
|
+
console.warn("followOrCreateLink: Error loading or saving new linked document: ".concat(object, ": ").concat(err_3));
|
|
67493
|
+
return [3 /*break*/, 8];
|
|
67494
|
+
case 8: return [2 /*return*/, object];
|
|
67495
|
+
}
|
|
67496
|
+
});
|
|
67497
|
+
});
|
|
67498
|
+
}
|
|
67499
|
+
exports.followOrCreateLink = followOrCreateLink;
|
|
66180
67500
|
function loadProfile(store, user) {
|
|
66181
67501
|
return __awaiter(this, void 0, void 0, function () {
|
|
66182
|
-
var
|
|
67502
|
+
var err_4;
|
|
66183
67503
|
return __generator(this, function (_a) {
|
|
66184
67504
|
switch (_a.label) {
|
|
66185
67505
|
case 0:
|
|
@@ -66194,8 +67514,8 @@ function loadProfile(store, user) {
|
|
|
66194
67514
|
_a.sent();
|
|
66195
67515
|
return [3 /*break*/, 4];
|
|
66196
67516
|
case 3:
|
|
66197
|
-
|
|
66198
|
-
throw new Error("Unable to load profile of user
|
|
67517
|
+
err_4 = _a.sent();
|
|
67518
|
+
throw new Error("Unable to load profile of user ".concat(user, ": ").concat(err_4));
|
|
66199
67519
|
case 4: return [2 /*return*/, user.doc()];
|
|
66200
67520
|
}
|
|
66201
67521
|
});
|
|
@@ -66204,27 +67524,32 @@ function loadProfile(store, user) {
|
|
|
66204
67524
|
exports.loadProfile = loadProfile;
|
|
66205
67525
|
function loadPreferences(store, user) {
|
|
66206
67526
|
return __awaiter(this, void 0, void 0, function () {
|
|
66207
|
-
var
|
|
67527
|
+
var possiblePreferencesFile, preferencesFile, message, err_5;
|
|
66208
67528
|
return __generator(this, function (_a) {
|
|
66209
67529
|
switch (_a.label) {
|
|
66210
67530
|
case 0: return [4 /*yield*/, loadProfile(store, user)];
|
|
66211
67531
|
case 1:
|
|
66212
|
-
|
|
66213
|
-
|
|
67532
|
+
_a.sent();
|
|
67533
|
+
possiblePreferencesFile = suggestPreferencesFile(user);
|
|
67534
|
+
return [4 /*yield*/, followOrCreateLink(store, user, ns.space('preferencesFile'), possiblePreferencesFile, user.doc())];
|
|
67535
|
+
case 2:
|
|
67536
|
+
preferencesFile = _a.sent();
|
|
66214
67537
|
if (!preferencesFile) {
|
|
66215
|
-
|
|
67538
|
+
message = "User ".concat(user, " has no pointer in profile to preferences file.");
|
|
67539
|
+
console.warn(message);
|
|
66216
67540
|
return [2 /*return*/, undefined];
|
|
66217
67541
|
}
|
|
66218
|
-
|
|
66219
|
-
|
|
66220
|
-
|
|
66221
|
-
|
|
66222
|
-
|
|
66223
|
-
|
|
66224
|
-
|
|
66225
|
-
|
|
66226
|
-
|
|
66227
|
-
return [2 /*return*/,
|
|
67542
|
+
_a.label = 3;
|
|
67543
|
+
case 3:
|
|
67544
|
+
_a.trys.push([3, 5, , 6]);
|
|
67545
|
+
return [4 /*yield*/, store.fetcher.load(preferencesFile)];
|
|
67546
|
+
case 4:
|
|
67547
|
+
_a.sent();
|
|
67548
|
+
return [3 /*break*/, 6];
|
|
67549
|
+
case 5:
|
|
67550
|
+
err_5 = _a.sent();
|
|
67551
|
+
return [2 /*return*/, undefined];
|
|
67552
|
+
case 6: return [2 /*return*/, preferencesFile];
|
|
66228
67553
|
}
|
|
66229
67554
|
});
|
|
66230
67555
|
});
|
|
@@ -66232,7 +67557,7 @@ function loadPreferences(store, user) {
|
|
|
66232
67557
|
exports.loadPreferences = loadPreferences;
|
|
66233
67558
|
function loadTypeIndexesFor(store, user) {
|
|
66234
67559
|
return __awaiter(this, void 0, void 0, function () {
|
|
66235
|
-
var profile,
|
|
67560
|
+
var profile, suggestion, publicTypeIndex, publicScopes, preferencesFile, err_6, privateScopes, suggestedPrivateTypeIndex, privateTypeIndex, _a, scopes, files, err_7;
|
|
66236
67561
|
return __generator(this, function (_b) {
|
|
66237
67562
|
switch (_b.label) {
|
|
66238
67563
|
case 0:
|
|
@@ -66241,30 +67566,55 @@ function loadTypeIndexesFor(store, user) {
|
|
|
66241
67566
|
return [4 /*yield*/, loadProfile(store, user)];
|
|
66242
67567
|
case 1:
|
|
66243
67568
|
profile = _b.sent();
|
|
66244
|
-
|
|
66245
|
-
|
|
66246
|
-
_b.label = 2;
|
|
67569
|
+
suggestion = suggestPublicTypeIndex(user);
|
|
67570
|
+
return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('publicTypeIndex'), suggestion, profile)];
|
|
66247
67571
|
case 2:
|
|
66248
|
-
_b.
|
|
66249
|
-
|
|
67572
|
+
publicTypeIndex = _b.sent();
|
|
67573
|
+
publicScopes = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
|
|
67574
|
+
_b.label = 3;
|
|
66250
67575
|
case 3:
|
|
66251
|
-
_b.
|
|
66252
|
-
return [
|
|
67576
|
+
_b.trys.push([3, 5, , 6]);
|
|
67577
|
+
return [4 /*yield*/, loadPreferences(store, user)];
|
|
66253
67578
|
case 4:
|
|
66254
|
-
|
|
66255
|
-
return [3 /*break*/,
|
|
67579
|
+
preferencesFile = _b.sent();
|
|
67580
|
+
return [3 /*break*/, 6];
|
|
66256
67581
|
case 5:
|
|
66257
|
-
|
|
66258
|
-
|
|
67582
|
+
err_6 = _b.sent();
|
|
67583
|
+
preferencesFile = null;
|
|
67584
|
+
return [3 /*break*/, 6];
|
|
66259
67585
|
case 6:
|
|
66260
|
-
preferencesFile
|
|
66261
|
-
|
|
66262
|
-
|
|
66263
|
-
|
|
66264
|
-
|
|
66265
|
-
|
|
66266
|
-
|
|
66267
|
-
|
|
67586
|
+
if (!preferencesFile) return [3 /*break*/, 9];
|
|
67587
|
+
suggestedPrivateTypeIndex = suggestPrivateTypeIndex(preferencesFile);
|
|
67588
|
+
_a = store.any(user, ns.solid('privateTypeIndex'), undefined, profile);
|
|
67589
|
+
if (_a) return [3 /*break*/, 8];
|
|
67590
|
+
return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('privateTypeIndex'), suggestedPrivateTypeIndex, preferencesFile)];
|
|
67591
|
+
case 7:
|
|
67592
|
+
_a = (_b.sent());
|
|
67593
|
+
_b.label = 8;
|
|
67594
|
+
case 8:
|
|
67595
|
+
privateTypeIndex = _a;
|
|
67596
|
+
privateScopes = privateTypeIndex ? [{ label: 'private', index: privateTypeIndex, agent: user }] : [];
|
|
67597
|
+
return [3 /*break*/, 10];
|
|
67598
|
+
case 9:
|
|
67599
|
+
privateScopes = [];
|
|
67600
|
+
_b.label = 10;
|
|
67601
|
+
case 10:
|
|
67602
|
+
scopes = publicScopes.concat(privateScopes);
|
|
67603
|
+
if (scopes.length === 0)
|
|
67604
|
+
return [2 /*return*/, scopes];
|
|
67605
|
+
files = scopes.map(function (scope) { return scope.index; });
|
|
67606
|
+
_b.label = 11;
|
|
67607
|
+
case 11:
|
|
67608
|
+
_b.trys.push([11, 13, , 14]);
|
|
67609
|
+
return [4 /*yield*/, store.fetcher.load(files)];
|
|
67610
|
+
case 12:
|
|
67611
|
+
_b.sent();
|
|
67612
|
+
return [3 /*break*/, 14];
|
|
67613
|
+
case 13:
|
|
67614
|
+
err_7 = _b.sent();
|
|
67615
|
+
console.warn('Problems loading type index: ', err_7);
|
|
67616
|
+
return [3 /*break*/, 14];
|
|
67617
|
+
case 14: return [2 /*return*/, scopes];
|
|
66268
67618
|
}
|
|
66269
67619
|
});
|
|
66270
67620
|
});
|
|
@@ -66272,44 +67622,30 @@ function loadTypeIndexesFor(store, user) {
|
|
|
66272
67622
|
exports.loadTypeIndexesFor = loadTypeIndexesFor;
|
|
66273
67623
|
function loadCommunityTypeIndexes(store, user) {
|
|
66274
67624
|
return __awaiter(this, void 0, void 0, function () {
|
|
66275
|
-
var preferencesFile, communities,
|
|
66276
|
-
|
|
66277
|
-
|
|
66278
|
-
switch (_a.label) {
|
|
67625
|
+
var preferencesFile, communities, result, _i, communities_1, org, _a, _b;
|
|
67626
|
+
return __generator(this, function (_c) {
|
|
67627
|
+
switch (_c.label) {
|
|
66279
67628
|
case 0: return [4 /*yield*/, loadPreferences(store, user)];
|
|
66280
67629
|
case 1:
|
|
66281
|
-
preferencesFile =
|
|
66282
|
-
if (preferencesFile)
|
|
66283
|
-
|
|
66284
|
-
|
|
66285
|
-
|
|
66286
|
-
|
|
66287
|
-
|
|
66288
|
-
|
|
66289
|
-
|
|
66290
|
-
|
|
66291
|
-
|
|
66292
|
-
|
|
66293
|
-
|
|
66294
|
-
|
|
66295
|
-
|
|
66296
|
-
|
|
66297
|
-
|
|
66298
|
-
|
|
66299
|
-
|
|
66300
|
-
*/
|
|
66301
|
-
// return communityTypeIndexesPromise.resolve()
|
|
66302
|
-
];
|
|
66303
|
-
// const communityTypeIndexes = await Promise.all(communityTypeIndexesPromise)
|
|
66304
|
-
/*
|
|
66305
|
-
let result = [] as TypeIndex[]
|
|
66306
|
-
for(const community of communities) {
|
|
66307
|
-
result = result.concat(await loadTypeIndexesFor(store, community as NamedNode)) as TypeIndex[] // @@ how oto make functional with async?
|
|
66308
|
-
}
|
|
66309
|
-
*/
|
|
66310
|
-
// return communityTypeIndexesPromise.resolve()
|
|
66311
|
-
}
|
|
66312
|
-
return [2 /*return*/, []];
|
|
67630
|
+
preferencesFile = _c.sent();
|
|
67631
|
+
if (!preferencesFile) return [3 /*break*/, 6];
|
|
67632
|
+
communities = store.each(user, ns.solid('community'), undefined, preferencesFile).concat(store.each(user, ns.solid('community'), undefined, user.doc()));
|
|
67633
|
+
result = [];
|
|
67634
|
+
_i = 0, communities_1 = communities;
|
|
67635
|
+
_c.label = 2;
|
|
67636
|
+
case 2:
|
|
67637
|
+
if (!(_i < communities_1.length)) return [3 /*break*/, 5];
|
|
67638
|
+
org = communities_1[_i];
|
|
67639
|
+
_b = (_a = result).concat;
|
|
67640
|
+
return [4 /*yield*/, loadTypeIndexesFor(store, org)];
|
|
67641
|
+
case 3:
|
|
67642
|
+
result = _b.apply(_a, [_c.sent()]);
|
|
67643
|
+
_c.label = 4;
|
|
67644
|
+
case 4:
|
|
67645
|
+
_i++;
|
|
67646
|
+
return [3 /*break*/, 2];
|
|
67647
|
+
case 5: return [2 /*return*/, result];
|
|
67648
|
+
case 6: return [2 /*return*/, []]; // No communities
|
|
66313
67649
|
}
|
|
66314
67650
|
});
|
|
66315
67651
|
});
|
|
@@ -66330,11 +67666,159 @@ function loadAllTypeIndexes(store, user) {
|
|
|
66330
67666
|
});
|
|
66331
67667
|
}
|
|
66332
67668
|
exports.loadAllTypeIndexes = loadAllTypeIndexes;
|
|
67669
|
+
// Utility: remove duplicates from Array of NamedNodes
|
|
67670
|
+
function uniqueNodes(arr) {
|
|
67671
|
+
var uris = arr.map(function (x) { return x.uri; });
|
|
67672
|
+
var set = new Set(uris);
|
|
67673
|
+
var uris2 = Array.from(set);
|
|
67674
|
+
var arr2 = uris2.map(function (u) { return new rdflib_1.NamedNode(u); });
|
|
67675
|
+
return arr2; // Array.from(new Set(arr.map(x => x.uri))).map(u => sym(u))
|
|
67676
|
+
}
|
|
67677
|
+
exports.uniqueNodes = uniqueNodes;
|
|
67678
|
+
function getScopedAppsFromIndex(store, scope, theClass) {
|
|
67679
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67680
|
+
var index, registrations, relevant, directInstances, instances, instanceContainers, containers, i, cont, contents;
|
|
67681
|
+
return __generator(this, function (_a) {
|
|
67682
|
+
switch (_a.label) {
|
|
67683
|
+
case 0:
|
|
67684
|
+
index = scope.index;
|
|
67685
|
+
registrations = store.statementsMatching(null, ns.solid('instance'), null, index)
|
|
67686
|
+
.concat(store.statementsMatching(null, ns.solid('instanceContainer'), null, index))
|
|
67687
|
+
.map(function (st) { return st.subject; });
|
|
67688
|
+
relevant = theClass ? registrations.filter(function (reg) { return store.any(reg, ns.solid('forClass'), null, index).sameTerm(theClass); })
|
|
67689
|
+
: registrations;
|
|
67690
|
+
directInstances = relevant.map(function (reg) { return store.each(reg, ns.solid('instance'), null, index); }).flat();
|
|
67691
|
+
instances = uniqueNodes(directInstances);
|
|
67692
|
+
instanceContainers = relevant.map(function (reg) { return store.each(reg, ns.solid('instanceContainer'), null, index); }).flat();
|
|
67693
|
+
containers = uniqueNodes(instanceContainers);
|
|
67694
|
+
if (containers.length > 0) {
|
|
67695
|
+
console.log('@@ getScopedAppsFromIndex containers ', containers);
|
|
67696
|
+
}
|
|
67697
|
+
i = 0;
|
|
67698
|
+
_a.label = 1;
|
|
67699
|
+
case 1:
|
|
67700
|
+
if (!(i < containers.length)) return [3 /*break*/, 4];
|
|
67701
|
+
cont = containers[i];
|
|
67702
|
+
return [4 /*yield*/, store.fetcher.load(cont)];
|
|
67703
|
+
case 2:
|
|
67704
|
+
_a.sent();
|
|
67705
|
+
contents = store.each(cont, ns.ldp('contains'), null, cont);
|
|
67706
|
+
instances = instances.concat(contents);
|
|
67707
|
+
_a.label = 3;
|
|
67708
|
+
case 3:
|
|
67709
|
+
i++;
|
|
67710
|
+
return [3 /*break*/, 1];
|
|
67711
|
+
case 4: return [2 /*return*/, instances.map(function (instance) { return { instance: instance, scope: scope }; })];
|
|
67712
|
+
}
|
|
67713
|
+
});
|
|
67714
|
+
});
|
|
67715
|
+
}
|
|
67716
|
+
exports.getScopedAppsFromIndex = getScopedAppsFromIndex;
|
|
67717
|
+
function getScopedAppInstances(store, klass, user) {
|
|
67718
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67719
|
+
var scopes, scopedApps, _i, scopes_1, scope, scopedApps0;
|
|
67720
|
+
return __generator(this, function (_a) {
|
|
67721
|
+
switch (_a.label) {
|
|
67722
|
+
case 0: return [4 /*yield*/, loadAllTypeIndexes(store, user)];
|
|
67723
|
+
case 1:
|
|
67724
|
+
scopes = _a.sent();
|
|
67725
|
+
scopedApps = [];
|
|
67726
|
+
_i = 0, scopes_1 = scopes;
|
|
67727
|
+
_a.label = 2;
|
|
67728
|
+
case 2:
|
|
67729
|
+
if (!(_i < scopes_1.length)) return [3 /*break*/, 5];
|
|
67730
|
+
scope = scopes_1[_i];
|
|
67731
|
+
return [4 /*yield*/, getScopedAppsFromIndex(store, scope, klass)];
|
|
67732
|
+
case 3:
|
|
67733
|
+
scopedApps0 = _a.sent();
|
|
67734
|
+
scopedApps = scopedApps.concat(scopedApps0);
|
|
67735
|
+
_a.label = 4;
|
|
67736
|
+
case 4:
|
|
67737
|
+
_i++;
|
|
67738
|
+
return [3 /*break*/, 2];
|
|
67739
|
+
case 5: return [2 /*return*/, scopedApps];
|
|
67740
|
+
}
|
|
67741
|
+
});
|
|
67742
|
+
});
|
|
67743
|
+
}
|
|
67744
|
+
exports.getScopedAppInstances = getScopedAppInstances;
|
|
67745
|
+
// This is the function signature which used to be in solid-ui/logic
|
|
67746
|
+
// Recommended to use getScopedAppInstances instead as it provides more information.
|
|
67747
|
+
//
|
|
67748
|
+
function getAppInstances(store, klass) {
|
|
67749
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67750
|
+
var user, scopedAppInstances;
|
|
67751
|
+
return __generator(this, function (_a) {
|
|
67752
|
+
switch (_a.label) {
|
|
67753
|
+
case 0:
|
|
67754
|
+
user = currentUser();
|
|
67755
|
+
if (!user)
|
|
67756
|
+
throw new Error('getAppInstances: Must be logged in to find apps.');
|
|
67757
|
+
return [4 /*yield*/, getScopedAppInstances(store, klass, user)];
|
|
67758
|
+
case 1:
|
|
67759
|
+
scopedAppInstances = _a.sent();
|
|
67760
|
+
return [2 /*return*/, scopedAppInstances.map(function (scoped) { return scoped.instance; })];
|
|
67761
|
+
}
|
|
67762
|
+
});
|
|
67763
|
+
});
|
|
67764
|
+
}
|
|
67765
|
+
exports.getAppInstances = getAppInstances;
|
|
66333
67766
|
/*
|
|
66334
|
-
|
|
66335
|
-
|
|
67767
|
+
* Register a new app in a type index
|
|
67768
|
+
* used in chat in bookmark.js (solid-ui)
|
|
67769
|
+
* Returns the registration object if successful else null
|
|
67770
|
+
*/
|
|
67771
|
+
function registerInstanceInTypeIndex(store, instance, index, theClass) {
|
|
67772
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67773
|
+
var registration, ins, err_8, msg;
|
|
67774
|
+
return __generator(this, function (_a) {
|
|
67775
|
+
switch (_a.label) {
|
|
67776
|
+
case 0:
|
|
67777
|
+
registration = (0, uri_1.newThing)(index);
|
|
67778
|
+
ins = [
|
|
67779
|
+
// See https://github.com/solid/solid/blob/main/proposals/data-discovery.md
|
|
67780
|
+
(0, rdflib_1.st)(registration, ns.rdf('type'), ns.solid('TypeRegistration'), index),
|
|
67781
|
+
(0, rdflib_1.st)(registration, ns.solid('forClass'), theClass, index),
|
|
67782
|
+
(0, rdflib_1.st)(registration, ns.solid('instance'), instance, index)
|
|
67783
|
+
];
|
|
67784
|
+
_a.label = 1;
|
|
67785
|
+
case 1:
|
|
67786
|
+
_a.trys.push([1, 3, , 4]);
|
|
67787
|
+
return [4 /*yield*/, store.updater.update([], ins)];
|
|
67788
|
+
case 2:
|
|
67789
|
+
_a.sent();
|
|
67790
|
+
return [3 /*break*/, 4];
|
|
67791
|
+
case 3:
|
|
67792
|
+
err_8 = _a.sent();
|
|
67793
|
+
msg = "Unable to register ".concat(instance, " in index ").concat(index, ": ").concat(err_8);
|
|
67794
|
+
console.warn(msg);
|
|
67795
|
+
return [2 /*return*/, null];
|
|
67796
|
+
case 4: return [2 /*return*/, registration];
|
|
67797
|
+
}
|
|
67798
|
+
});
|
|
67799
|
+
});
|
|
66336
67800
|
}
|
|
66337
|
-
|
|
67801
|
+
exports.registerInstanceInTypeIndex = registerInstanceInTypeIndex;
|
|
67802
|
+
function deleteTypeIndexRegistration(store, item) {
|
|
67803
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67804
|
+
var reg, statements;
|
|
67805
|
+
return __generator(this, function (_a) {
|
|
67806
|
+
switch (_a.label) {
|
|
67807
|
+
case 0:
|
|
67808
|
+
reg = store.the(null, ns.solid('instance'), item.instance, item.scope.index);
|
|
67809
|
+
if (!reg)
|
|
67810
|
+
throw new Error("deleteTypeIndexRegistration: No registration found for ".concat(item.instance));
|
|
67811
|
+
statements = store.statementsMatching(reg, null, null, item.scope.index);
|
|
67812
|
+
return [4 /*yield*/, store.updater.update(statements, [])];
|
|
67813
|
+
case 1:
|
|
67814
|
+
_a.sent();
|
|
67815
|
+
return [2 /*return*/];
|
|
67816
|
+
}
|
|
67817
|
+
});
|
|
67818
|
+
});
|
|
67819
|
+
}
|
|
67820
|
+
exports.deleteTypeIndexRegistration = deleteTypeIndexRegistration;
|
|
67821
|
+
// ENDS
|
|
66338
67822
|
//# sourceMappingURL=discoveryLogic.js.map
|
|
66339
67823
|
|
|
66340
67824
|
/***/ }),
|
|
@@ -66348,7 +67832,7 @@ export async function getAppInstances (store:LiveStore, klass: NamedNode) {
|
|
|
66348
67832
|
"use strict";
|
|
66349
67833
|
|
|
66350
67834
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
66351
|
-
exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.
|
|
67835
|
+
exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.uniqueNodes = exports.suggestPublicTypeIndex = exports.suggestPrivateTypeIndex = exports.suggestPreferencesFile = exports.registerInstanceInTypeIndex = exports.loadTypeIndexesFor = exports.loadProfile = exports.loadPreferences = exports.loadOrCreateIfNotExists = exports.loadCommunityTypeIndexes = exports.loadAllTypeIndexes = exports.getScopedAppsFromIndex = exports.getScopedAppInstances = exports.getAppInstances = exports.followOrCreateLink = exports.deleteTypeIndexRegistration = exports.loadIndex = exports.registerInTypeIndex = exports.loadTypeIndexes = exports.ensureTypeIndexes = exports.genACLText = exports.setACLUserPublic = void 0;
|
|
66352
67836
|
// Make these variables directly accessible as it is what you need most of the time
|
|
66353
67837
|
// This also makes these variable globaly accesible in mashlib
|
|
66354
67838
|
var solidLogicSingleton_1 = __webpack_require__(/*! ./logic/solidLogicSingleton */ "./node_modules/solid-logic/lib/logic/solidLogicSingleton.js");
|
|
@@ -66370,12 +67854,25 @@ Object.defineProperty(exports, "ensureTypeIndexes", ({ enumerable: true, get: fu
|
|
|
66370
67854
|
Object.defineProperty(exports, "loadTypeIndexes", ({ enumerable: true, get: function () { return typeIndexLogic_1.loadTypeIndexes; } }));
|
|
66371
67855
|
Object.defineProperty(exports, "registerInTypeIndex", ({ enumerable: true, get: function () { return typeIndexLogic_1.registerInTypeIndex; } }));
|
|
66372
67856
|
Object.defineProperty(exports, "loadIndex", ({ enumerable: true, get: function () { return typeIndexLogic_1.loadIndex; } }));
|
|
67857
|
+
// Generate by
|
|
67858
|
+
// grep export src/discovery/discoveryLogic.ts | sed -e 's/export //g' | sed -e 's/async //g'| sed -e 's/function //g' | sed -e 's/ .*/,/g' | sort
|
|
66373
67859
|
var discoveryLogic_1 = __webpack_require__(/*! ./discovery/discoveryLogic */ "./node_modules/solid-logic/lib/discovery/discoveryLogic.js");
|
|
66374
|
-
Object.defineProperty(exports, "
|
|
67860
|
+
Object.defineProperty(exports, "deleteTypeIndexRegistration", ({ enumerable: true, get: function () { return discoveryLogic_1.deleteTypeIndexRegistration; } }));
|
|
67861
|
+
Object.defineProperty(exports, "followOrCreateLink", ({ enumerable: true, get: function () { return discoveryLogic_1.followOrCreateLink; } }));
|
|
67862
|
+
Object.defineProperty(exports, "getAppInstances", ({ enumerable: true, get: function () { return discoveryLogic_1.getAppInstances; } }));
|
|
67863
|
+
Object.defineProperty(exports, "getScopedAppInstances", ({ enumerable: true, get: function () { return discoveryLogic_1.getScopedAppInstances; } }));
|
|
67864
|
+
Object.defineProperty(exports, "getScopedAppsFromIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.getScopedAppsFromIndex; } }));
|
|
67865
|
+
Object.defineProperty(exports, "loadAllTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadAllTypeIndexes; } }));
|
|
67866
|
+
Object.defineProperty(exports, "loadCommunityTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadCommunityTypeIndexes; } }));
|
|
67867
|
+
Object.defineProperty(exports, "loadOrCreateIfNotExists", ({ enumerable: true, get: function () { return discoveryLogic_1.loadOrCreateIfNotExists; } }));
|
|
66375
67868
|
Object.defineProperty(exports, "loadPreferences", ({ enumerable: true, get: function () { return discoveryLogic_1.loadPreferences; } }));
|
|
67869
|
+
Object.defineProperty(exports, "loadProfile", ({ enumerable: true, get: function () { return discoveryLogic_1.loadProfile; } }));
|
|
66376
67870
|
Object.defineProperty(exports, "loadTypeIndexesFor", ({ enumerable: true, get: function () { return discoveryLogic_1.loadTypeIndexesFor; } }));
|
|
66377
|
-
Object.defineProperty(exports, "
|
|
66378
|
-
Object.defineProperty(exports, "
|
|
67871
|
+
Object.defineProperty(exports, "registerInstanceInTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.registerInstanceInTypeIndex; } }));
|
|
67872
|
+
Object.defineProperty(exports, "suggestPreferencesFile", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPreferencesFile; } }));
|
|
67873
|
+
Object.defineProperty(exports, "suggestPrivateTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPrivateTypeIndex; } }));
|
|
67874
|
+
Object.defineProperty(exports, "suggestPublicTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPublicTypeIndex; } }));
|
|
67875
|
+
Object.defineProperty(exports, "uniqueNodes", ({ enumerable: true, get: function () { return discoveryLogic_1.uniqueNodes; } }));
|
|
66379
67876
|
var SolidLogic_1 = __webpack_require__(/*! ./logic/SolidLogic */ "./node_modules/solid-logic/lib/logic/SolidLogic.js");
|
|
66380
67877
|
Object.defineProperty(exports, "SolidLogic", ({ enumerable: true, get: function () { return SolidLogic_1.SolidLogic; } }));
|
|
66381
67878
|
var authUtil_1 = __webpack_require__(/*! ./authn/authUtil */ "./node_modules/solid-logic/lib/authn/authUtil.js");
|
|
@@ -66951,7 +68448,7 @@ var _fetch = function (url, requestInit) { return __awaiter(void 0, void 0, void
|
|
|
66951
68448
|
var omitCreds;
|
|
66952
68449
|
return __generator(this, function (_a) {
|
|
66953
68450
|
omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit';
|
|
66954
|
-
if (authSession_1.authSession.info.webId && !omitCreds) { // see https://github.com/
|
|
68451
|
+
if (authSession_1.authSession.info.webId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114
|
|
66955
68452
|
// In fact ftech should respect crentials omit itself
|
|
66956
68453
|
return [2 /*return*/, authSession_1.authSession.fetch(url, requestInit)];
|
|
66957
68454
|
}
|
|
@@ -67182,7 +68679,7 @@ function ensureLoadedPreferences(context) {
|
|
|
67182
68679
|
* Resolves with the same context, outputting
|
|
67183
68680
|
* output: index.public, index.private
|
|
67184
68681
|
* @@ This is a very bizare function
|
|
67185
|
-
* @see https://github.com/
|
|
68682
|
+
* @see https://github.com/solidos/solid/blob/main/proposals/data-discovery.md#discoverability
|
|
67186
68683
|
*/
|
|
67187
68684
|
function loadIndex(context, isPublic) {
|
|
67188
68685
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -67245,7 +68742,7 @@ function loadTypeIndexes(context) {
|
|
|
67245
68742
|
exports.loadTypeIndexes = loadTypeIndexes;
|
|
67246
68743
|
/**
|
|
67247
68744
|
* Resolves with the same context, outputting
|
|
67248
|
-
* @see https://github.com/
|
|
68745
|
+
* @see https://github.com/solidos/solid/blob/main/proposals/data-discovery.md#discoverability
|
|
67249
68746
|
*/
|
|
67250
68747
|
function ensureTypeIndexes(context, agent) {
|
|
67251
68748
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -67273,7 +68770,7 @@ exports.ensureTypeIndexes = ensureTypeIndexes;
|
|
|
67273
68770
|
* Many reasons for failing including script not having permission etc
|
|
67274
68771
|
*
|
|
67275
68772
|
* Adds its output to the context
|
|
67276
|
-
* @see https://github.com/
|
|
68773
|
+
* @see https://github.com/solidos/solid/blob/main/proposals/data-discovery.md#discoverability
|
|
67277
68774
|
*/
|
|
67278
68775
|
function ensureOneTypeIndex(context, isPublic, agent) {
|
|
67279
68776
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -67426,7 +68923,7 @@ function registerInTypeIndex(context, instance, theClass, isPublic, agent // Def
|
|
|
67426
68923
|
index = indexes[0];
|
|
67427
68924
|
registration = (0, uri_1.newThing)(index);
|
|
67428
68925
|
ins = [
|
|
67429
|
-
// See https://github.com/
|
|
68926
|
+
// See https://github.com/solidos/solid/blob/main/proposals/data-discovery.md
|
|
67430
68927
|
(0, rdflib_1.st)(registration, exports.ns.rdf('type'), exports.ns.solid('TypeRegistration'), index),
|
|
67431
68928
|
(0, rdflib_1.st)(registration, exports.ns.solid('forClass'), theClass, index),
|
|
67432
68929
|
(0, rdflib_1.st)(registration, exports.ns.solid('instance'), instance, index)
|
|
@@ -67530,7 +69027,7 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
67530
69027
|
});
|
|
67531
69028
|
});
|
|
67532
69029
|
};
|
|
67533
|
-
// Copied from https://github.com/
|
|
69030
|
+
// Copied from https://github.com/solidos/web-access-control-tests/blob/v3.0.0/test/surface/delete.test.ts#L5
|
|
67534
69031
|
UtilityLogic.prototype.setSinglePeerAccess = function (options) {
|
|
67535
69032
|
return __awaiter(this, void 0, void 0, function () {
|
|
67536
69033
|
var str, aclDocUrl;
|
|
@@ -67618,7 +69115,7 @@ var UtilityLogic = /** @class */ (function () {
|
|
|
67618
69115
|
headers: {
|
|
67619
69116
|
"Content-Type": "text/turtle",
|
|
67620
69117
|
"If-None-Match": "*",
|
|
67621
|
-
Link: '<http://www.w3.org/ns/ldp#BasicContainer>; rel="type"', // See https://github.com/
|
|
69118
|
+
Link: '<http://www.w3.org/ns/ldp#BasicContainer>; rel="type"', // See https://github.com/solidos/node-solid-server/issues/1465
|
|
67622
69119
|
},
|
|
67623
69120
|
body: " ", // work around https://github.com/michielbdejong/community-server/issues/4#issuecomment-776222863
|
|
67624
69121
|
})];
|