PageSourceSearch

https://app.rosalog.com/up/platform/oui/oui.js

js rosalog.com collected 2026-10-07 19:55:42 UTC 62,095 bytes, 1,399 lines download raw bytes

1var sr;
2(function (sr) {
3    var oui;
4    (function (oui) {
5        var Span = sr.ui.Span;
6        var MMSlotCardinality = sr.mm.model.MMSlotCardinality;
7        var SlotValueRenderer = sr.oui.logic.SlotValueRenderer;
8        var humanizeLocalDateFromNow = sr.util.datetime.humanizeLocalDateFromNow;
9        var formatDecimal = sr.util.format.formatDecimal;
10        var formatDistance = sr.util.formatDistance;
11        var formatDurationInSecs = sr.util.format.formatDurationInSecs;
12        var MMSlot = sr.mm.model.MMSlot;
13        class OuiLogic {
14        }
15        oui.OuiLogic = OuiLogic;
16        function formatValue(slot, val, extended = false) {
17            let ret;
18            if (slot.format) {
19                switch (slot.format) {
20                    case "distance":
21                        ret = formatDistance(val);
22                        break;
23                    case "duration":
24                        ret = formatDurationInSecs(val);
25                        break;
26                }
27            }
28            if (!ret) {
29                if (slot.ofSimpleType == sr.mm.model.MMSimpleType.BOOLEAN) {
30                    if (val === false) {
31                        ret = "Non";
32                    }
33                    else if (val === true) {
34                        ret = "Oui";
35                    }
36                }
37                else if (slot.ofSimpleType == sr.mm.model.MMSimpleType.DATE) {
38                    if (val) {
39                        const formatter = JSJoda.DateTimeFormatter.ofPattern("d MMMM yyyy").withLocale(JSJodaLocale.Locale.FRANCE);
40                        let localDate = sr.util.datetime.parseLocalDate(val);
41                        ret = formatter.format(localDate);
42                        //notifySuccess("aaaa");
43                        if (false) {
44                            ret += " (" + humanizeLocalDateFromNow(localDate) + ")";
45                        }
46                    }
47                }
48                else if (slot.ofSimpleType == sr.mm.model.MMSimpleType.DATETIME || slot.ofSimpleType == sr.mm.model.MMSimpleType.TIMESTAMP) {
49                    let formatter;
50                    if (slot.technical)
51                        formatter = JSJoda.DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss:SSS");
52                    else
53                        formatter = JSJoda.DateTimeFormatter.ofPattern("d MMMM yyyy à HH:mm").withLocale(JSJodaLocale.Locale.FRANCE);
54                    if (val) {
55                        let dateTime;
56                        if (slot.ofSimpleType == sr.mm.model.MMSimpleType.TIMESTAMP)
57                            dateTime = sr.util.datetime.parseInstantToLocalDateTimeAtBrowserZone(val);
58                        else
59                            dateTime = sr.util.datetime.parseLocalDateTimeToLocalDateTimeAtBrowserZone(val);
60                        ret = formatter.format(dateTime);
61                    }
62                }
63                else if (slot.ofSimpleType == sr.mm.model.MMSimpleType.INTEGER) {
64                    ret = "" + val;
65                }
66                else if (slot.ofSimpleType == sr.mm.model.MMSimpleType.DECIMAL) {
67                    ret = formatDecimal(val, 2);
68                }
69                else if (slot.ofSimpleType == sr.mm.model.MMSimpleType.FLOAT || slot.ofSimpleType == sr.mm.model.MMSimpleType.DOUBLE) {
70                    ret = formatDecimal(val, 2);
71                }
72                else if (slot.kind == sr.mm.model.MMSlotKind.ENUM) {
73                    ret = sr.NLS(slot.ofEnumType.name, val);
74                    if (!ret)
75                        ret = val;
76                }
77            }
78            if (typeof val == 'string' && val.length > 255)
79                return val.substring(0, 255) + "...";
80            if (val == null)
81                return "";
82            if (!ret)
83                ret = "" + val;
84            return ret;
85        }
86        oui.formatValue = formatValue;
87        function renderValue(slot, val, extended = false) {
88            let ret = "";
89            if (slot.ofSimpleType == sr.mm.model.MMSimpleType.COLOR) {
90                //DOCUPFONC-126-3{
91                if (val) {
92                    let span = new Span("ui label clickable", "");
93                    span.setStyle("padding: 1em 2em 1em 2em;background-color:#" + val);
94                    ret = span;
95                }
96                //}DOCUPFONC-126-3
97            }
98            else {
99                ret = formatValue(slot, val, extended);
100            }
101            return ret;
102        }
103        oui.renderValue = renderValue;
104        class Column {
105            constructor(title, percent, ...path) {
106                this.visible = true;
107                this.sortable = true;
108                this.mainColumn = false;
109                this.title = title;
110                this.percent = percent;
111                this.path = path;
112            }
113            pathToString() {
114                let ret = "";
115                let i = 0;
116                if (this.path)
117                    for (let slot of this.path) {
118                        if (i != 0)
119                            ret += ".";
120                        ret += slot.name;
121                        i++;
122                    }
123                return ret;
124            }
125            orderPathToArrayString() {
126                let ret = [];
127                for (let slot of (this.orderPath || this.path)) {
128                    ret.push(slot.name);
129                }
130                return ret.length > 0 ? ret : null;
131            }
132        }
133        oui.Column = Column;
134        class Head extends sr.ui.TH {
135        }
136        oui.Head = Head;
137        class TableOptions {
138            constructor() {
139                this.withChecks = true;
140            }
141        }
142        oui.TableOptions = TableOptions;
143        class Table extends sr.ui.SRElement {
144            constructor(referencer = null, withTopButtons = false, options = new TableOptions(), objectViewFactory = null) {
145                super("div");
146                this.referencer = referencer;
147                this.withTopButtons = withTopButtons;
148                this.options = options;
149                this.objectViewFactory = objectViewFactory;
150                this.headChecked = false;
151                this.inner = new sr.ui.semantic.Table();
152                this.columns = [];
153                this.heads = [];
154                this.rowClickListeners = [];
155                this.headClickListeners = [];
156                this.rowCheckListeners = [];
157                this.headCheckListeners = [];
158                this.rowAddListeners = [];
159                this.checks = [];
160                this.currentContent = [];
161                if (withTopButtons) {
162                    this.topButtons = new sr.ui.Div();
163                    this.topButtons.setClass("flex");
164                    this.add(this.topButtons);
165                    this.topLeft = new sr.ui.Div();
166                    this.topLeft.setStyle("");
167                    this.topButtons.add(this.topLeft);
168                    this.topRight = new sr.ui.Div();
169                    this.topRight.setStyle("");
170                    this.topButtons.add(this.topRight);
171                }
172                this.inner = new sr.ui.semantic.Table();
173                this.add(this.inner);
174                let storageAccess;
175                let app = null;
176                if (objectViewFactory) {
177                    storageAccess = objectViewFactory.storageAccess;
178                    app = objectViewFactory.app;
179                }
180                this.slotValueRenderer = new SlotValueRenderer(referencer, storageAccess, app);
181            }
182            init() {
183                let __this = this;
184                if (__this.withTopButtons) {
185                    if (false) {
186                        let button = new sr.ui.semantic.Button(null, "settings");
187                        button.addClass("circular");
188                        this.topLeft.add(button);
189                    }
190                    let dropDown = new sr.ui.semantic.DropDown("");
191                    dropDown.setMultiple();
192                    dropDown.init({ useLabels: false });
193                    //dropDown.addClass(" icon");
194                    this.topRight.add(dropDown);
195                    for (let c of this.columns) {
196                        let item = dropDown.addMenuItem(c.title, e => {
197                            c.visible = !c.visible;
198                            __this.refresh();
199                        });
200                        item.setActive(c.visible);
201                    }
202                    dropDown.menu.setStyle("right:3px;left:unset;"); // Pour aligner à droite le menu
203                    dropDown.setStyle("padding:0.78571429em 2.1em 0.78571429em 1em;;"); //Pour contourner le bug de semantic qui en cas de multiple/sans label se trompe sur le padding 
204                }
205                this.inner.init();
206            }
207            setColumns(columns) {
208                let __this = this;
209                this.columns = columns;
210                this.heads = [];
211            }
212            getColumnsCount() {
213                return (this.options.withChecks ? 1 : 0) + this.columns.length;
214            }
215            addRowClickListener(f) {
216                this.rowClickListeners.push(f);
217            }
218            addHeadClickListener(f) {
219                this.headClickListeners.push(f);
220            }
221            addRowCheckListener(f) {
222                this.rowCheckListeners.push(f);
223            }
224            addHeadCheckListener(f) {
225                this.headCheckListeners.push(f);
226            }
227            addRowAddListener(f) {
228                this.rowAddListeners.push(f);
229            }
230            createHeader() {
231                let __this = this;
232                this.inner.makeHead();
233                this.inner.thead.removeChildren();
234                //check
235                if (__this.options.withChecks) {
236                    let th = new Head("");
237                    th.addClass("right aligned");
238                    th.setAttribute("width", "35px");
239                    this.inner.thead.add(th);
240                    let checkbox = new sr.ui.semantic.Checkbox("", "", null);
241                    checkbox.setValue(__this.headChecked);
242                    th.add(checkbox);
243                    checkbox.addClickListener(function (e) {
244                        __this.headChecked = checkbox.getValue();
245                        __this.headCheckListeners.forEach(f => {
246                            f(__this.headChecked);
247                        });
248                        e.stopPropagation();
249                    });
250                    th.addClickListener(function (e) {
251                        sr.util.dispatchClick(checkbox.el);
252                        e.stopPropagation();
253                        return true;
254                    });
255                }
256                //data columns
257                this.heads = [];
258                let nbColumns = 0;
259                let sumPercent = 0;
260                for (let column of this.columns)
261                    if (column.visible) {
262                        nbColumns++;
263                        if (column.percent)
264                            sumPercent += column.percent;
265                    }
266                for (let column of this.columns) {
267                    if (column.visible) {
268                        let head = new Head(column.title);
269                        this.heads.push(head);
270                        head.column = column;
271                        if (column.percent)
272                            head.setAttribute("width", 100 * (column.percent / sumPercent) + "%");
273                        else if (column.px)
274                            head.setAttribute("width", column.px + "px");
275                        else
276                            head.setAttribute("width", 100 / nbColumns + "%");
277                        this.inner.thead.add(head);
278                        head.addClickListener(function (f) {
279                            __this.onHeadClick(head);
280                        });
281                        head.addContextMenuListener(function (e) {
282                            e.preventDefault();
283                            return true;
284                        });
285                    }
286                }
287            }
288            refreshHeader() {
289                for (let head of this.heads) {
290                }
291            }
292            setContent(o) {
293                let __this = this;
294                __this.clearContent();
295                for (let row of o) {
296                    __this.addRow(o);
297                }
298            }
299            clearContent() {
300                this.inner.clearContent();
301                this.checks = [];
302                this.currentContent = [];
303            }
304            refresh() {
305                let saveContent = this.currentContent;
306                this.createHeader();
307                this.clearContent();
308                for (let row of saveContent) {
309                    this.addRow(row.row, row.checked, row.selected);
310                }
311            }
312            addRow(row, checked = false, selected = false) {
313                let __this = this;
314                let contentRow = [];
315                this.currentContent.push({ row: row, checked: checked, selected: selected });
316                for (let column of this.columns) {
317                    if (column.visible) {
318                        if (column.func) {
319                            contentRow.push(column.func(row));
320                        }
321                        else if (column.path) {
322                            let renderedValue = __this.slotValueRenderer.renderValueForCellInTable(column.path, row);
323                            contentRow.push(renderedValue);
324                        }
325                    }
326                }
327                let tr = this.inner.addTR();
328                if (__this.options.withChecks) {
329                    let check = new sr.ui.semantic.Checkbox("", "", null);
330                    if (checked)
331                        check.setValue(true);
332                    __this.checks.push(check);
333                    let tdcheck = new sr.ui.TD(check, "right aligned");
334                    //            check.addChangeListener( function() {
335                    //                __this.onRowCheck( check.getValue(), row );
336                    //            } );
337                    __this.syncCheckAndColor(check, tr);
338                    if (selected && this.selectedTR)
339                        __this.syncSelectedAndColor(false, this.selectedTR);
340                    __this.syncSelectedAndColor(selected, tr);
341                    __this.selectedTR = tr;
342                    check.addClickListener(function (e) {
343                        __this.syncCheckAndColor(check, tr);
344                        __this.onRowCheck(check.getValue(), row);
345                        e.stopPropagation();
346                    });
347                    tdcheck.addClickListener(function (e) {
348                        sr.util.dispatchClick(check.el);
349                        e.stopPropagation();
350                        return false;
351                    });
352                    tr.addCell(tdcheck);
353                }
354                sr.ui.semantic.Table.addCells(tr, contentRow);
355                tr.addClickListener(function (e) {
356                    console.info("clicked on ", arguments);
357                    if (e.target.tagName != "TD" && !(e.target.className.indexOf("clickable") >= 0)) {
358                        console.debug("Not on td so prevent open detail", e.target);
359                    }
360                    else if (__this.onRowClick(row, tr)) {
361                        if (__this.selectedTR)
362                            __this.syncSelectedAndColor(false, __this.selectedTR);
363                        __this.selectedTR = tr;
364                        __this.syncSelectedAndColor(true, tr);
365                    }
366                });
367                tr.el.addEventListener("mouseenter", function () {
368                    //                __this.onRowClick( row );
369                });
370                __this.notifyAddRow(row, tr);
371                return tr;
372            }
373            syncCheckAndColor(check, tr) {
374                let positive = "positive";
375                if (check.getValue())
376                    tr.addClass(positive);
377                else
378                    tr.removeClass(positive);
379            }
380            syncSelectedAndColor(selected, tr) {
381                let active = "active";
382                if (selected)
383                    tr.addClass(active);
384                else
385                    tr.removeClass(active);
386            }
387            onRowClick(row, tr) {
388                let __this = this;
389                console.info("clicked row", row);
390                let ret = true;
391                for (let listener of this.rowClickListeners) {
392                    ret = ret && listener(row, tr);
393                }
394                return ret;
395            }
396            onHeadClick(head) {
397                console.info("clicked column", head);
398                for (let listener of this.headClickListeners) {
399                    listener(head);
400                }
401            }
402            onRowCheck(v, row) {
403                console.info("check row", JSON.stringify(row));
404                for (let listener of this.rowCheckListeners) {
405                    listener(v, row);
406                }
407            }
408            notifyAddRow(row, tr) {
409                for (let listener of this.rowAddListeners) {
410                    listener(row, tr);
411                }
412            }
413        }
414        oui.Table = Table;
415        class TableData {
416            constructor(data, referencer) {
417                this.data = data;
418                this.referencer = referencer;
419            }
420            setData(data) {
421                this.data.splice(0); //removeAll
422                if (data)
423                    for (let value of data)
424                        this.data.push(value);
425            }
426            refresh(serviceMethod) {
427                let __this = this;
428                return new Promise((resolve, reject) => {
429                    serviceMethod.then(function (dataRetrieved) {
430                        __this.data = dataRetrieved;
431                        __this.counted = undefined;
432                        resolve();
433                    }).catch(reject);
434                });
435            }
436            setRequest(request) {
437                let __this = this;
438                __this.request = request;
439                return __this.init(__this.mmClass);
440            }
441            init(mmClass) {
442                let __this = this;
443                __this.mmClass = mmClass;
444                return new Promise((resolve, reject) => {
445                    resolve(__this.data.length);
446                });
447            }
448            recount() {
449                let __this = this;
450                return new Promise((resolve, reject) => {
451                    let i = 0;
452                    let count = 0;
453                    while (i < __this.data.length) {
454                        if (!__this.request || sr.datarequest.filter(__this.mmClass, __this.request.selection, __this.data[i])) {
455                            count++;
456                        }
457                        i++;
458                    }
459                    __this.counted = count;
460                    resolve(count);
461                });
462            }
463            getDataIds(index, nb) {
464                return this.getData(index, nb, null, null);
465            }
466            getData(index, nb, orderBy, orderAsc) {
467                let __this = this;
468                return new Promise((resolve, reject) => {
469                    if (orderBy)
470                        __this.data.sort(sr.mm.makeComparator(orderBy.path, orderAsc, __this.referencer));
471                    let ret = [];
472                    let i = 0;
473                    let retSize = 0;
474                    let matchCount = 0;
475                    while (i < __this.data.length && retSize < nb) {
476                        if (!__this.request || sr.datarequest.filter(__this.mmClass, __this.request.selection, __this.data[i])) {
477                            matchCount++;
478                            if (matchCount > index) {
479                                ret.push(__this.data[i]);
480                                retSize++;
481                            }
482                        }
483                        i++;
484                    }
485                    if (sr.debug)
486                        console.trace("getdata", index, nb);
487                    resolve(ret);
488                });
489            }
490            size() {
491                let __this = this;
492                if (__this.counted != undefined)
493                    return __this.counted;
494                else
495                    return __this.data.length;
496            }
497        }
498        oui.TableData = TableData;
499        class StoragePartialRetriever {
500            constructor(storageAccess, mmClass = null) {
501                this.storageAccess = storageAccess;
502                this.mmClass = mmClass;
503            }
504            setRequest(request) {
505                let __this = this;
506                __this.request = request;
507                return __this.init(__this.mmClass);
508            }
509            init(mmClass) {
510                let __this = this;
511                __this.mmClass = mmClass;
512                return __this.recount();
513            }
514            recount() {
515                let __this = this;
516                return new Promise((resolve, reject) => {
517                    if (this.sightName != null) {
518                        __this.storageAccess.countWithNamedQuery(__this.mmClass, this.sightModuleName, this.sightServiceName, this.sightName, __this.request).then(function (x) {
519                            __this.totalsize = x;
520                            resolve(__this.totalsize);
521                        });
522                    }
523                    else {
524                        __this.storageAccess.count(__this.mmClass, __this.request).then(function (x) {
525                            __this.totalsize = x;
526                            resolve(__this.totalsize);
527                        });
528                    }
529                });
530            }
531            getDataIds(index, nb) {
532                let __this = this;
533                let request = __this.request || new sr.datarequest.model.Request();
534                let requestProjected = new sr.datarequest.model.Request(request);
535                requestProjected.projection = ["dataId"];
536                if (this.sightName != null) {
537                    return __this.storageAccess.queryRangeWithNamedQuery(__this.mmClass, this.sightModuleName, this.sightServiceName, this.sightName, requestProjected, index, nb, true, function (x) {
538                    });
539                }
540                else {
541                    return __this.storageAccess.queryRange(__this.mmClass, requestProjected, index, nb, true, function (x) {
542                    });
543                }
544            }
545            getData(index, nb, orderBy, orderAsc) {
546                let __this = this;
547                let request = __this.request || new sr.datarequest.model.Request();
548                if (orderBy) {
549                    request.orderBy = orderBy.orderPathToArrayString();
550                    request.orderAsc = orderAsc;
551                }
552                if (this.sightName != null) {
553                    return __this.storageAccess.queryRangeWithNamedQuery(__this.mmClass, this.sightModuleName, this.sightServiceName, this.sightName, request, index, nb, true, function (x) {
554                    });
555                }
556                else {
557                    return __this.storageAccess.queryRange(__this.mmClass, request, index, nb, true, function (x) {
558                    });
559                }
560            }
561            size() {
562                return this.totalsize;
563            }
564            setSight(moduleName, sightServiceName, sightName) {
565                let __this = this;
566                this.sightModuleName = moduleName;
567                this.sightServiceName = sightServiceName;
568                this.sightName = sightName;
569                return __this.init(__this.mmClass);
570            }
571        }
572        oui.StoragePartialRetriever = StoragePartialRetriever;
573        class DataTableOptions {
574            constructor() {
575                this.withChecks = true;
576                this.withDragAndDrop = false;
577                this.withActionButtons = false;
578                this.withActionDeleteButton = false;
579                this.withToolbar = true;
580                this.agGridOptions = {};
581                this.monoColumnOnly = false;
582                this.cssClass = undefined;
583            }
584        }
585        oui.DataTableOptions = DataTableOptions;
586        class DataTable extends sr.ui.SRElement {
587            constructor(inner = null, partialRetriver = null, referencer = null, withTopButtons = false, options = new DataTableOptions(), objectViewFactory = null) {
588                super("div");
589                this.referencer = referencer;
590                this.options = options;
591                this.objectViewFactory = objectViewFactory;
592                this.data = [];
593                this.checked = [];
594                this.selectedDataId = null;
595                this.visibleRows = 10;
596                this.currentPage = 0;
597                this.contentHasJustBeenCleared = false;
598                this.checkedSelectListeners = [];
599                let __this = this;
600                let innerTableOptions = {
601                    withChecks: options.withChecks
602                };
603                this.inner = inner || new Table(referencer, withTopButtons, innerTableOptions, objectViewFactory);
604                this.el = this.inner.el;
605                this.inner.inner.addClass("sortable");
606                this.throttledRefresh = _.throttle(this.refresh, 500);
607                this.partialRetriever = partialRetriver || new TableData(__this.data, referencer);
608                this.inner.addRowCheckListener(function (v, row) {
609                    if (v) {
610                        __this.checked.push(row);
611                        for (let selectCheckListener of __this.checkedSelectListeners)
612                            selectCheckListener.addOneToSelection(row);
613                    }
614                    else {
615                        let index = sr.util.indexOfByDataId(__this.checked, row);
616                        if (index > -1) {
617                            __this.checked.splice(index, 1);
618                        }
619                        for (let selectCheckListener of __this.checkedSelectListeners)
620                            selectCheckListener.removeOneFromSelection(row);
621                    }
622                });
623                this.inner.addHeadCheckListener(function (v) {
624                    console.log("HeadCheckListener", v);
625                    if (v) {
626                        for (let selectCheckListener of __this.checkedSelectListeners)
627                            selectCheckListener.clearSelection();
628                        __this.partialRetriever.getDataIds(0, __this.partialRetriever.size())
629                            .then(function (data) {
630                            __this.checked = data;
631                            for (let selectCheckListener of __this.checkedSelectListeners)
632                                selectCheckListener.setSelection(data);
633                            __this.refresh();
634                        });
635                    }
636                    else {
637                        __this.checked = [];
638                        for (let selectCheckListener of __this.checkedSelectListeners)
639                            selectCheckListener.clearSelection();
640                        __this.refresh();
641                    }
642                });
643                this.inner.addHeadClickListener(function (head) {
644                    if (head.column == __this.orderBy) {
645                        __this.orderAsc = !__this.orderAsc;
646                    }
647                    else {
648                        __this.orderAsc = true;
649                    }
650                    //                if ( __this.orderBy )
651                    //                    __this.orderBy.setClass( "" );
652                    head.setClass("sorted " + (__this.orderAsc ? "ascending" : "descending"));
653                    __this.orderBy = head.column;
654                    __this.refresh();
655                });
656            }
657            setColumns(columns) {
658                this.inner.setColumns(columns);
659            }
660            setHeight(inPixels) {
661                let __this = this;
662                //let fixed = 165;// Pour les non planifiés 
663                //let fixed = 137;// Pour les pages de données
664                let fixed = 200;
665                let v = Math.ceil((window.innerHeight - __this.el.offsetTop - fixed) / 40);
666                if (v < 1)
667                    v = 1;
668                let currentTop = __this.currentPage * __this.visibleRows;
669                __this.visibleRows = v;
670                __this.currentPage = Math.floor(currentTop / __this.visibleRows);
671                __this.refresh();
672            }
673            init() {
674                let __this = this;
675                this.inner.init();
676                this.makeFoot();
677            }
678            addRowClickListener(f) {
679                this.inner.addRowClickListener(f);
680            }
681            addCheckedSelectListener(o) {
682                this.checkedSelectListeners.push(o);
683            }
684            gotoRowAndRefresh(row) {
685                let __this = this;
686                if (row && row.dataId) {
687                    let n = 0;
688                    let found = null;
689                    __this.selectedDataId = row.dataId;
690                    let localData = __this.partialRetriever.getData(0, 999999999, __this.orderBy, __this.orderAsc);
691                    localData.then(data => {
692                        for (let elem of data) {
693                            if (elem && elem.dataId && elem.dataId == __this.selectedDataId) {
694                                found = n;
695                                break;
696                            }
697                            n++;
698                        }
699                        if (found != null) {
700                            this.currentPage = Math.floor(found / __this.visibleRows);
701                            __this.refresh();
702                        }
703                    });
704                }
705            }
706            clearContent() {
707                //this.partialRetriever.data = [];
708                this.orderBy = null;
709                this.orderAsc = false;
710                this.currentPage = 0;
711                while (this.data.length)
712                    this.data.pop();
713                this.inner.clearContent();
714                this.refresh();
715                this.contentHasJustBeenCleared = true;
716            }
717            createHeader() {
718                let __this = this;
719                this.inner.createHeader();
720                for (let head of this.inner.heads) {
721                    if (head.column == __this.orderBy) {
722                        head.setClass("sorted " + (__this.orderAsc ? "ascending" : "descending"));
723                    }
724                }
725            }
726            addRow(row, checked) {
727                let __this = this;
728                let length = __this.data.push(row);
729                let ret = null;
730                if (this.contentHasJustBeenCleared && length <= this.visibleRows) {
731                    ret = this.innerAddRow(row, checked);
732                }
733                __this.throttledRefresh(false);
734                return ret;
735            }
736            clearCheckeds() {
737                let __this = this;
738                __this.checked = [];
739            }
740            setChecked(rows) {
741                let __this = this;
742                __this.checked = [];
743                for (let row of rows) {
744                    __this.checked.push(row);
745                }
746            }
747            getChecked() {
748                return this.checked;
749            }
750            addToChecked(row) {
751                let __this = this;
752                let index = sr.util.indexOfByDataId(__this.checked, row);
753                if (index < 0) {
754                    __this.checked.push(row);
755                }
756            }
757            removeFromChecked(row) {
758                let __this = this;
759                let index = sr.util.indexOfByDataId(__this.checked, row);
760                if (index > -1) {
761                    __this.checked.splice(index, 1);
762                }
763            }
764            setRequest(request) {
765                let __this = this;
766                return __this.partialRetriever.setRequest(request);
767            }
768            refresh(refreshRows = true, refreshFoot = true) {
769                let __this = this;
770                this.createHeader();
771                if (refreshRows) {
772                    __this.partialRetriever.recount().then(function (x) {
773                        __this.limitCurrentPage();
774                        let index = __this.currentPage * __this.visibleRows;
775                        let localData = __this.partialRetriever.getData(index, __this.visibleRows, __this.orderBy, __this.orderAsc);
776                        __this.inner.inner.setLoaderVisible(true);
777                        localData.then(function (data) {
778                            __this.inner.inner.setLoaderVisible(false);
779                            __this.inner.clearContent();
780                            for (let i = 0; i < data.length; i++) {
781                                if (data[i]) {
782                                    __this.innerAddRow(data[i]);
783                                }
784                            }
785                        }).catch(function (e) {
786                            __this.inner.inner.setLoaderVisible(false);
787                            __this.inner.clearContent();
788                            console.error("Erreur pendant la lecture des données", e);
789                            sr.ui.notifyError("Erreur pendant la lecture des données : " + e.responseText);
790                        });
791                        if (refreshFoot) {
792                            __this.makeFoot();
793                            __this.drawPageButtons();
794                        }
795                    });
796                }
797                else {
798                    __this.limitCurrentPage();
799                    if (refreshFoot) {
800                        __this.makeFoot();
801                        __this.drawPageButtons();
802                    }
803                }
804            }
805            setOptionSingleLine() {
806                this.inner.inner.addClass("single line");
807            }
808            addElement(element) {
809                this.inner.topLeft.add(element);
810            }
811            addRowAddListener(listener) {
812                this.inner.addRowAddListener(listener);
813            }
814            // private methods
815            innerAddRow(row, checked) {
816                let inChecked = checked || sr.util.indexOfByDataId(this.checked, row) > -1;
817                let selected = (row && row.dataId && row.dataId == this.selectedDataId);
818                return this.inner.addRow(row, inChecked, selected);
819            }
820            makeFoot() {
821                let __this = this;
822                this.inner.inner.makeFoot();
823                this.inner.inner.tfoot.removeChildren();
824                let tr = new sr.ui.TR();
825                let th = new sr.ui.TH();
826                th.setAttribute("colspan", this.inner.getColumnsCount());
827                tr.add(th);
828                let topElem = __this.visibleRows * __this.currentPage + 1;
829                let number = topElem + __this.visibleRows - 1;
830                let total = __this.partialRetriever.size();
831                let labelString;
832                if (total > 0) {
833                    if (number > total)
834                        number = total;
835                    labelString = topElem + "-" + number + " / " + total + " element" + (total > 1 ? "s" : "");
836                }
837                else {
838                    labelString = "Aucun element";
839                }
840                this.nbElem = new sr.ui.Label(labelString);
841                th.add(this.nbElem);
842                let div = new sr.ui.Div("ui right floated pagination menu");
843                th.add(div);
844                this.topButton = new sr.ui.semantic.A("icon item", null, "angle double left icon");
845                div.add(this.topButton);
846                this.leftButton = new sr.ui.semantic.A("icon item", null, "angle left icon");
847                div.add(this.leftButton);
848                this.rightButton = new sr.ui.semantic.A("icon item", null, "angle right icon");
849                div.add(this.rightButton);
850                this.bottomButton = new sr.ui.semantic.A("icon item", null, "angle double right icon");
851                div.add(this.bottomButton);
852                this.inner.inner.tfoot.add(th);
853                this.topButton.addClickListener(function () {
854                    __this.currentPage = 0;
855                    __this.refresh();
856                });
857                this.leftButton.addClickListener(function () {
858                    __this.currentPage--;
859                    __this.limitCurrentPage();
860                    __this.refresh();
861                });
862                this.rightButton.addClickListener(function () {
863                    __this.currentPage++;
864                    __this.limitCurrentPage();
865                    __this.refresh();
866                });
867                this.bottomButton.addClickListener(function () {
868                    __this.currentPage = __this.pagesCount() - 1;
869                    __this.refresh();
870                });
871                if (this.currentPage == 0) {
872                    this.leftButton.setEnabled(false);
873                    this.topButton.setEnabled(false);
874                }
875                else {
876                    this.leftButton.setEnabled(true);
877                    this.topButton.setEnabled(true);
878                }
879                if (this.currentPage == this.pagesCount() - 1 || this.pagesCount() == 0) {
880                    this.rightButton.setEnabled(false);
881                    this.bottomButton.setEnabled(false);
882                }
883                else {
884                    this.rightButton.setEnabled(true);
885                    this.bottomButton.setEnabled(true);
886                }
887            }
888            drawPageButtons() {
889                let __this = this;
890                let isSmall = __this.inner.el.offsetWidth < 600;
891                do {
892                    let next = this.leftButton.el.nextElementSibling;
893                    if (next != this.rightButton.el)
894                        next.remove();
895                    else
896                        break;
897                } while (true);
898                let start = this.currentPage - 5;
899                if (start < 0)
900                    start = 0;
901                let end = start + 10;
902                if (end > this.pagesCount()) {
903                    end = this.pagesCount();
904                    start = end - 10;
905                    if (start < 0)
906                        start = 0;
907                }
908                //            let g = new sr.ui.Div("ui grid");
909                //            let r = new sr.ui.Div("tablet only computer only row");
910                for (let i = start; i < end; i++) {
911                    let pageButton = new sr.ui.semantic.A("item", "" + (i + 1));
912                    let style = "width: 50px;text-align: center;display: block;";
913                    pageButton.setAttribute("style", style);
914                    let show = true;
915                    if (i == this.currentPage) {
916                        pageButton.setAttribute("style", style + "font-weight: bold;background-color: #f1f1f1");
917                    }
918                    else {
919                        if (isSmall) {
920                            show = false;
921                        }
922                    }
923                    if (show)
924                        this.rightButton.el.parentElement.insertBefore(pageButton.el, this.rightButton.el);
925                    pageButton.addClickListener(function () {
926                        __this.currentPage = i;
927                        __this.refresh();
928                    });
929                }
930            }
931            limitCurrentPage() {
932                let __this = this;
933                if (__this.currentPage >= __this.pagesCount())
934                    __this.currentPage = __this.pagesCount() - 1;
935                if (__this.currentPage < 0)
936                    __this.currentPage = 0;
937            }
938            pagesCount() {
939                return Math.ceil(this.partialRetriever.size() / this.visibleRows);
940            }
941        }
942        oui.DataTable = DataTable;
943        function createColumnsFromClass(app, objectViewFactory, mmClass, max = 5) {
944            let columns = [];
945            let n = 0;
946            let enabledFeatures = app.enabledFeatures();
947            for (let slot of sr.mm.getTransitiveSlots(mmClass)) {
948                let mustSkip = objectViewFactory.mustSkip(enabledFeatures, mmClass, slot);
949                if (!mustSkip && !slot.technical && !slot.unused && !slot.secret && enabledFeatures["DataTable." + slot.name] != false) {
950                    if (slot.ofSimpleType) {
951                        //let title = sr.NLS(mmClass.name, slot.name, "name");
952                        let title = nlsForPath(mmClass, [slot]);
953                        if (!title)
954                            title = slot.name;
955                        else
956                            title = title.name;
957                        let columnWidth = 5;
958                        if (slot == sr.datalayer.DataEntity.idSlot)
959                            columnWidth = 8;
960                        else if (slot.ofSimpleType == sr.mm.model.MMSimpleType.STRING || slot.ofSimpleType == sr.mm.model.MMSimpleType.TEXT) {
961                            columnWidth = 20;
962                        }
963                        let column = new sr.oui.Column(title, (columnWidth), slot);
964                        if (slot.name.indexOf("name") >= 0)
965                            column.mainColumn = true;
966                        columns.push(column);
967                        if (n++ > max)
968                            return columns;
969                    }
970                    else if (slot.kind == sr.mm.model.MMSlotKind.ASSOCIATION) {
971                        if (slot.ofClass instanceof sr.mm.model.MMClass) {
972                            if (true || slot.cardinality == MMSlotCardinality.SINGLE) {
973                                let associatedClass = slot.ofClass;
974                                if (true) { //!associatedClass.isLarge && !associatedClass.isMassive) {
975                                    let title = nlsForPath(mmClass, [slot]);
976                                    if (!title)
977                                        title = slot.name;
978                                    else
979                                        title = title.name;
980                                    let columnWidth = 20;
981                                    let column = new sr.oui.Column(title, (columnWidth), slot);
982                                    columns.push(column);
983                                    if (n++ > max)
984                                        return columns;
985                                }
986                            }
987                            else {
988                                // multiple
989                            }
990                        }
991                    }
992                    else if (slot.kind == sr.mm.model.MMSlotKind.COMPOSITION && slot.ofClass) {
993                        let mmClass = slot.ofClass;
994                        if (slot.cardinality == MMSlotCardinality.SINGLE) {
995                            for (let subSlot of mmClass.slots) {
996                                if (subSlot.ofSimpleType) {
997                                    if (subSlot.name == "displayName") {
998                                        let title = sr.NLS(mmClass.name, subSlot.name, "name");
999                                        if (!title)
1000                                            title = slot.name;
1001                                        let subColumn = new sr.oui.Column(title, (subSlot.ofSimpleType == sr.mm.model.MMSimpleType.STRING ? 10 : 5), slot, subSlot);
1002                                        if (subSlot.name.indexOf("displayName") >= 0)
1003                                            subColumn.mainColumn = true;
1004                                        columns.push(subColumn);
1005                                        if (n++ > max)
1006                                            return columns;
1007                                    }
1008                                }
1009                            }
1010                        }
1011                        else { //MULTIPLE
1012                            let title = nlsForPath(mmClass, [slot]);
1013                            if (!title)
1014                                title = slot.name;
1015                            else
1016                                title = title.name;
1017                            let columnWidth = 20;
1018                            let column = new sr.oui.Column(title, (columnWidth), slot);
1019                            columns.push(column);
1020                            if (n++ > max)
1021                                return columns;
1022                        }
1023                    }
1024                }
1025            }
1026            return columns;
1027        }
1028        oui.createColumnsFromClass = createColumnsFromClass;
1029        function createTableColumnsFromDef(app, objectViewFactory, mmClass, classTable) {
1030            let cols = classTable.columns;
1031            let columns = [];
1032            let enabledFeatures = app.enabledFeatures();
1033            for (let col of cols) {
1034                let mustSkip = false;
1035                if (col.path && col.path.length > 0) {
1036                    mustSkip = objectViewFactory.mustSkip(enabledFeatures, mmClass, col.path[0]);
1037                }
1038                if (!mustSkip) {
1039                    let column = new sr.oui.Column(col.name, col.wide);
1040                    column.visible = col.visible;
1041                    column.path = col.path;
1042                    column.orderPath = col.orderPath;
1043                    let orderPath = column.orderPath || column.path;
1044                    if (orderPath && orderPath.length > 0)
1045                        column.sortable = !orderPath[0].calculated;
1046                    else
1047                        column.sortable = false; //on ne trie pas les champs dont on ne connais pas le path
1048                    if (col.name)
1049                        column.title = col.name;
1050                    else {
1051                        let title = nlsForPath(mmClass, col.path);
1052                        if (!title)
1053                            column.title = col.name;
1054                        else
1055                            column.title = title.name;
1056                    }
1057                    columns.push(column);
1058                }
1059            }
1060            if (classTable && classTable.classLookups) {
1061                let enabledFeatures = app.enabledFeatures();
1062                for (const classLookup of classTable.classLookups) {
1063                    if (enabledFeatures[classLookup.mmClassName]) {
1064                        // champ size
1065                        {
1066                            let slotName = classLookup.newCompositionName + "_size";
1067                            let dynamicSlot = new MMSlot({
1068                                "name": slotName,
1069                                "ofSimpleType": sr.mm.model.MMSimpleType.INTEGER,
1070                                "kind": sr.mm.model.MMSlotKind.SIMPLE,
1071                                "cardinality": sr.mm.model.MMSlotCardinality.SINGLE
1072                            });
1073                            let column = new sr.oui.Column(slotName, 8);
1074                            column.visible = true;
1075                            column.path = [dynamicSlot];
1076                            column.orderPath = column.path;
1077                            column.sortable = true;
1078                            let title = nlsForPath(mmClass, column.path);
1079                            if (!title)
1080                                column.title = slotName;
1081                            else
1082                                column.title = title.name;
1083                            columns.push(column);
1084                        }
1085                    }
1086                    let slotCalcs = classLookup.slotCalcs;
1087                    if (slotCalcs)
1088                        for (let slotCalc of slotCalcs) {
1089                            for (let operation of slotCalc.operations) {
1090                                //let slotName = MongoLookupBuilder.underscoredSlotName(classLookup, slotCalc, operation);
1091                                let slotName = classLookup.newCompositionName + "_calc_" + slotCalc.name + "_" + operation;
1092                                let dynamicSlot = new MMSlot({
1093                                    "name": slotName,
1094                                    "ofSimpleType": sr.mm.model.MMSimpleType.DECIMAL,
1095                                    "kind": sr.mm.model.MMSlotKind.SIMPLE,
1096                                    "cardinality": sr.mm.model.MMSlotCardinality.SINGLE
1097                                });
1098                                let column = new sr.oui.Column(slotName, 8);
1099                                column.visible = true;
1100                                column.path = [dynamicSlot];
1101                                column.orderPath = column.path;
1102                                column.sortable = true;
1103                                let title = nlsForPath(mmClass, column.path);
1104                                if (!title)
1105                                    column.title = slotName;
1106                                else
1107                                    column.title = title.name;
1108                                columns.push(column);
1109                            }
1110                        }
1111                }
1112            }
1113            return columns;
1114        }
1115        oui.createTableColumnsFromDef = createTableColumnsFromDef;
1116        class DataList extends sr.ui.Div {
1117            constructor() {
1118                super("ui middle aligned selection list");
1119                this.items = [];
1120                this.elements = [];
1121                this.listeners = [];
1122                this.el.style.overflowY = "auto";
1123            }
1124            addElement(element, caption) {
1125                let __this = this;
1126                let li = new sr.ui.semantic.Item();
1127                __this.items.push(li);
1128                __this.add(li);
1129                let content = new sr.ui.Div("content");
1130                li.add(content);
1131                let header = new sr.ui.Div("header", caption);
1132                content.add(header);
1133                li.addClickListener(function () {
1134                    __this.select(element);
1135                });
1136            }
1137            clear() {
1138                this.removeChildren();
1139            }
1140            selectPrivate(element) {
1141                let __this = this;
1142                let i = 0;
1143                for (let elem of __this.elements) {
1144                    if (elem == element) {
1145                        __this.items[i].addClass("active");
1146                    }
1147                    else {
1148                        __this.items[i].removeClass("active");
1149                    }
1150                    i++;
1151                }
1152            }
1153            select(object) {
1154                let __this = this;
1155                __this.selected = object;
1156                __this.selectPrivate(object);
1157                __this.notifyListeners();
1158            }
1159            addSelectElementListener(listener) {
1160                let __this = this;
1161                __this.listeners.push(listener);
1162            }
1163            notifyListeners() {
1164                let __this = this;
1165                for (let l of __this.listeners) {
1166                    l(__this.selected);
1167                }
1168            }
1169        }
1170        oui.DataList = DataList;
1171        class Data2Level extends sr.ui.SRElement {
1172            constructor(app, subEntityMMClass, dragDropListener) {
1173                super();
1174                this.app = app;
1175                this.subEntityMMClass = subEntityMMClass;
1176                this.dragDropListener = dragDropListener;
1177                this.topEntities = [];
1178                this.subEntities = {};
1179                this.topItems = {};
1180                this.subItems = {};
1181                this.listeners = [];
1182                this.checkedEntities = {};
1183                this.checkListeners = [];
1184                this.changingProgramatically = false;
1185                this.topEntitiesStates = {};
1186                this.index = 0;
1187                this.createAccordion();
1188                this.add(this.accordion);
1189            }
1190            addRootEntity(entity, caption) {
1191                let __this = this;
1192                let item = new sr.ui.semantic.AccordionItem(caption);
1193                item.title.setVisible(false);
1194                item.content.el.setAttribute("index", "" + __this.index);
1195                __this.accordion.addAccordionItem(item);
1196                __this.topEntities.push(entity);
1197                __this.topItems[entity.dataId] = item;
1198                if (!__this.topEntitiesStates[__this.index])
1199                    __this.topEntitiesStates[__this.index] = "open";
1200                __this.index++;
1201                item.addCheckListener(function (check) {
1202                    if (!__this.changingProgramatically) {
1203                        __this.changingProgramatically = true;
1204                        if (__this.subEntities[entity.dataId]) {
1205                            for (let subEntity of __this.subEntities[entity.dataId]) {
1206                                if (check.getValue()) {
1207                                    __this.checkedEntities[subEntity.dataId] = subEntity;
1208                                    if (__this.subItems[subEntity.dataId])
1209                                        __this.subItems[subEntity.dataId].checkbox.setValue(true);
1210                                }
1211                                else {
1212                                    delete __this.checkedEntities[subEntity.dataId];
1213                                    if (__this.subItems[subEntity.dataId])
1214                                        __this.subItems[subEntity.dataId].checkbox.setValue(false);
1215                                }
1216                            }
1217                        }
1218                        __this.changingProgramatically = false;
1219                        __this.notifyCheckChanged();
1220                    }
1221                });
1222            }
1223            visitItems(f) {
1224                let __this = this;
1225                for (let key in __this.topItems) {
1226                    let items = __this.topItems[key];
1227                }
1228            }
1229            addSubEntity(entity, subEntity, caption) {
1230                let __this = this;
1231                let item = __this.topItems[entity.dataId];
1232                let entityList = __this.subEntities[entity.dataId];
1233                let uiList;
1234                if (!entityList) {
1235                    entityList = __this.subEntities[entity.dataId] = [];
1236                    uiList = new sr.ui.semantic.List();
1237                    item.setSubContent(uiList);
1238                    item.title.setVisible(true);
1239                }
1240                else {
1241                    uiList = item.subContent;
1242                }
1243                entityList.push(subEntity);
1244                let listItem = new sr.ui.semantic.ItemRec(caption, undefined, undefined, undefined, subEntity.id);
1245                __this.subItems[subEntity.dataId] = listItem;
1246                uiList.addItem(listItem);
1247                if (this.checkedEntities[subEntity.dataId]) {
1248                    __this.checkedEntities[subEntity.dataId] = subEntity;
1249                    listItem.checkbox.setValue(true);
1250                }
1251                listItem.addClickListener(function (e) {
1252                    __this.selected = subEntity;
1253                    __this.select(subEntity);
1254                    for (let key in __this.subItems) {
1255                        __this.subItems[key].removeClass("active");
1256                    }
1257                    listItem.addClass("active");
1258                });
1259                listItem.addCheckListener(function (check) {
1260                    if (!__this.changingProgramatically) {
1261                        if (check.getValue()) {
1262                            __this.checkedEntities[subEntity.dataId] = subEntity;
1263                        }
1264                        else {
1265                            delete __this.checkedEntities[subEntity.dataId];
1266                        }
1267                        __this.changingProgramatically = true;
1268                        __this.topItems[entity.dataId].checkbox.setValue(false);
1269                        __this.changingProgramatically = false;
1270                        __this.notifyCheckChanged();
1271                    }
1272                });
1273                let dragDrop = new oui.DragDrop(__this.app);
1274                if (__this.dragDropListener)
1275                    dragDrop.addDragDropListener(listItem, subEntity, __this.subEntityMMClass, __this.dragDropListener);
1276            }
1277            clear() {
1278                this.topEntities = [];
1279                this.subEntities = {};
1280                this.topItems = {};
1281                this.index = 0;
1282                this.accordion.removeChildren();
1283            }
1284            beginReplace() {
1285                this.topEntities = [];
1286                this.subEntities = {};
1287                this.topItems = {};
1288                this.index = 0;
1289                this.createAccordion();
1290            }
1291            createAccordion() {
1292                let __this = this;
1293                if (this.accordion) {
1294                    this.accordion.remove();
1295                }
1296                this.accordion = new sr.ui.semantic.Accordion("sr-nowrap", function (element) {
1297                    let index = element.getAttribute("index");
1298                    let active = element.getAttribute("class").indexOf("active") >= 0;
1299                    if (active)
1300                        __this.topEntitiesStates[index] = "open";
1301                    else
1302                        __this.topEntitiesStates[index] = "close";
1303                });
1304                this.accordion.el.style.overflowY = "auto";
1305            }
1306            endReplace() {
1307                let __this = this;
1308                this.removeChildren();
1309                this.add(this.accordion);
1310                for (let x in __this.topEntitiesStates) {
1311                    if (__this.topEntitiesStates[x] == "open")
1312                        __this.accordion.open(parseInt(x));
1313                }
1314                __this.notifyCheckChanged();
1315            }
1316            selectPrivate(element) {
1317            }
1318            select(object) {
1319                let __this = this;
1320                __this.selected = object;
1321                __this.selectPrivate(object);
1322                __this.notifyListeners();
1323            }
1324            addSelectElementListener(listener) {
1325                let __this = this;
1326                __this.listeners.push(listener);
1327            }
1328            addCheckListener(listener) {
1329                let __this = this;
1330                __this.checkListeners.push(listener);
1331            }
1332            notifyCheckChanged() {
1333                let __this = this;
1334                let array = [];
1335                for (let dataId in __this.checkedEntities) {
1336                    array.push(__this.checkedEntities[dataId]);
1337                }
1338                for (let listener of __this.checkListeners) {
1339                    listener(array);
1340                }
1341            }
1342            notifyListeners() {
1343                let __this = this;
1344                for (let l of __this.listeners) {
1345                    l(__this.selected);
1346                }
1347            }
1348        }
1349        oui.Data2Level = Data2Level;
1350        function nlsForPathPrivate(mmClass, path) {
1351            let pathNames = [mmClass.name];
1352            for (let slot of path) {
1353                pathNames.push(slot.name);
1354            }
1355            let ret = sr.NLSP(pathNames);
1356            if (ret) {
1357                return ret;
1358            }
1359            else {
1360                if (path.length > 1) {
1361                    ret = nlsForPathPrivate(path[0].ofClass, path.slice(1));
1362                }
1363                if (ret)
1364                    return ret;
1365                else if (path.length == 1) {
1366                    return sr.NLSP([path[0].name]);
1367                }
1368            }
1369            return null;
1370        }
1371        function nlsForPath(mmClass, path, subClass = mmClass) {
1372            let ret = nlsForPathPrivate(mmClass, path);
1373            if (!ret && path && path.length > 0) {
1374                if (path[0].name == "id") {
1375                    ret = { name: sr.NLS("id").name };
1376                }
1377            }
1378            if (ret) {
1379                if (ret.name)
1380                    ret.name = sr.util.replace2(sr.currentApp.nls, ret.name);
1381                if (ret.description)
1382                    ret.description = sr.util.replace2(sr.currentApp.nls, ret.description);
1383                if (ret.comment)
1384                    ret.comment = sr.util.replace2(sr.currentApp.nls, ret.comment);
1385            }
1386            else {
1387                ret = {};
1388                ret.name = mmClass.name;
1389                for (let slot of path) {
1390                    ret.name += "." + slot.name;
1391                }
1392                ret.description = ret.name;
1393            }
1394            return ret;
1395        }
1396        oui.nlsForPath = nlsForPath;
1397    })(oui = sr.oui || (sr.oui = {}));
1398})(sr || (sr = {}));
1399//# sourceMappingURL=oui.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.