create-basicjs 0.1.7 → 0.1.9
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/bin/create-basicjs.js
CHANGED
|
@@ -124,13 +124,14 @@ const create = function (options) {
|
|
|
124
124
|
console.log("Open the folder in an AI coding tool and describe your app. To publish: node _basic/tools/build.js");
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
// The AGENTS.md of the published versions (0.1.1 - 0.1.
|
|
127
|
+
// The AGENTS.md of the published versions (0.1.1 - 0.1.7), as a new project got it (sha256).
|
|
128
128
|
// WHY: an update replaced only _basic/, so an AGENTS.md nobody changed kept the names of an older kit
|
|
129
129
|
// (styleName: "primary", ozdenType1, AutoLayout) next to a _basic/ that has them no more.
|
|
130
130
|
const OLD_AGENTS_HASHES = [
|
|
131
131
|
"2898b4e7a3e2b04754073f611bf26c13e8b2e5685c50582f10d1ae1f066ff8ba",
|
|
132
132
|
"ad7764b34b6f3e8d33fd89b2b0238102ff78e5613916e2fe1e3d999efd64c6e0",
|
|
133
133
|
"3092379ec5e7219f20dc64b6a69ac688c06b79d8c46d966977a2706d637b6811",
|
|
134
|
+
"95a7df2cb361b96743b0817cd27024b6a7bc04f32c74e2ccc39da8ddd3370d56", // 0.1.5 - 0.1.7
|
|
134
135
|
];
|
|
135
136
|
|
|
136
137
|
const hashOf = function (text) {
|
package/package.json
CHANGED
|
@@ -28,6 +28,17 @@ Add a `<script>` line to `index.htm` for the component and for every file in its
|
|
|
28
28
|
|
|
29
29
|
Pages load the source files (`name.js`). Components have no `.min.js` files.
|
|
30
30
|
|
|
31
|
+
## A component that lacks something
|
|
32
|
+
|
|
33
|
+
First look in the header of `_basic/comp/name.js`: a param, an event (Ex: `onCellCreate`) or a `style` key may do it already. When none does, make your own version of the component, and add the feature there:
|
|
34
|
+
|
|
35
|
+
1. Copy `_basic/comp/tiny-table.js` to `app/comp/tiny-table-plus.js` (a name that says what it adds).
|
|
36
|
+
2. In the copy, replace the name everywhere: `TinyTable` → `TinyTablePlus` (this also renames `TinyTableDefaults` and `TinyTable.styles`).
|
|
37
|
+
3. In `index.htm`, load the copy instead of the original, after the files it needs.
|
|
38
|
+
4. Change the copy, and use `TinyTablePlus` in the app.
|
|
39
|
+
|
|
40
|
+
Never change the file in `_basic/`: an update replaces it. Your copy keeps working after an update, but it does not get its fixes: change only what the feature needs.
|
|
41
|
+
|
|
31
42
|
## Rules that are easy to miss
|
|
32
43
|
|
|
33
44
|
- `const start = function () {}` is the entry point. basic.js creates the global `page` and then calls it. `loop()` runs every second when it exists.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.9
|
|
@@ -58,6 +58,10 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
58
58
|
- allowHtml: 0 (default): the values of the cells are written as plain text (a name or a title a user wrote does not
|
|
59
59
|
run as HTML). 1: the values are written as HTML (Ex: "<b>12</b>"). Your own values written with cell.label.text in
|
|
60
60
|
createCellView / updateCellView are not touched.
|
|
61
|
+
- numberFormat on a column: its numbers are shown in a format (the options of Intl.NumberFormat), and the data keeps
|
|
62
|
+
the number, so a sort is by the number, the filter looks in the number and updateCellView gets the number.
|
|
63
|
+
Ex: { name: "AMOUNT", dataTitle: "amount", numberFormat: { style: "currency", currency: "USD" } }: 1200 -> "$1,200.00".
|
|
64
|
+
The language is locale (above), or a locale of its own: numberFormat: { locale: "tr-TR", style: "currency", currency: "TRY" }.
|
|
61
65
|
|
|
62
66
|
|
|
63
67
|
*/
|
|
@@ -252,6 +256,33 @@ const SmartTable = function (params = {}) {
|
|
|
252
256
|
return NaN;
|
|
253
257
|
};
|
|
254
258
|
|
|
259
|
+
// "language options" -> Intl.NumberFormat (null: the options were wrong)
|
|
260
|
+
const numberFormatters = new Map();
|
|
261
|
+
|
|
262
|
+
const getNumberFormatter = function (options) {
|
|
263
|
+
const locale = options.locale || box.locale || document.documentElement.lang || DEFAULT_LOCALE;
|
|
264
|
+
const key = locale + " " + JSON.stringify(options);
|
|
265
|
+
if (numberFormatters.has(key)) return numberFormatters.get(key);
|
|
266
|
+
let formatter = null;
|
|
267
|
+
try {
|
|
268
|
+
formatter = new Intl.NumberFormat(locale, options);
|
|
269
|
+
} catch (error) {
|
|
270
|
+
// WHY: a wrong language tag or option (Ex: style "currency" with no currency) throws: the number is shown as it is
|
|
271
|
+
console.warn("SmartTable: numberFormat " + JSON.stringify(options) + ": " + error.message);
|
|
272
|
+
}
|
|
273
|
+
numberFormatters.set(key, formatter);
|
|
274
|
+
return formatter;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
// The text of a value in its cell: a number of a column with numberFormat is formatted, any other value stays.
|
|
278
|
+
const getShownValue = function (titleData, value) {
|
|
279
|
+
if (!titleData.numberFormat) return value;
|
|
280
|
+
const number = toSortNumber(value);
|
|
281
|
+
if (!Number.isFinite(number)) return value;
|
|
282
|
+
const formatter = getNumberFormatter(titleData.numberFormat);
|
|
283
|
+
return formatter ? formatter.format(number) : value;
|
|
284
|
+
};
|
|
285
|
+
|
|
255
286
|
// *** PUBLIC VARIABLES:
|
|
256
287
|
// State of component [var]
|
|
257
288
|
box.state = "normal";
|
|
@@ -339,13 +370,15 @@ const SmartTable = function (params = {}) {
|
|
|
339
370
|
const titleData = box.titleDataList[j];
|
|
340
371
|
const cell = itemLine["itemCell" + j];
|
|
341
372
|
const newValue = rowData[titleData.dataTitle] ?? "";
|
|
373
|
+
const shownValue = getShownValue(titleData, newValue);
|
|
342
374
|
|
|
343
|
-
// The DOM is touched only when the
|
|
375
|
+
// The DOM is touched only when the text changed
|
|
344
376
|
// WHY: label.text gives the innerHTML (a string): a number or a value with "&" was always different. The cell keeps the last value it wrote.
|
|
345
|
-
|
|
346
|
-
|
|
377
|
+
// WHY the shown value: a new locale changes the text of the same number.
|
|
378
|
+
if (!("lastValue" in cell) || cell.lastValue !== shownValue) { // WHY: without !==, 0 and "" were the same.
|
|
379
|
+
cell.lastValue = shownValue;
|
|
347
380
|
// WHY plainText: a value from a user (a name, a title) ran as HTML in the cell
|
|
348
|
-
setText(cell.label,
|
|
381
|
+
setText(cell.label, shownValue);
|
|
349
382
|
}
|
|
350
383
|
|
|
351
384
|
if (box.updateCellView) box.updateCellView(cell, j, newValue, box);
|
|
@@ -1058,6 +1091,7 @@ const SmartTable = function (params = {}) {
|
|
|
1058
1091
|
box.setLocale = function (locale) {
|
|
1059
1092
|
box.locale = locale;
|
|
1060
1093
|
box.updateInfoLabel();
|
|
1094
|
+
box.refreshData(); // WHY: the numbers of a column with numberFormat are written in it
|
|
1061
1095
|
};
|
|
1062
1096
|
// USAGE: smartTable.setLocale("en-US")
|
|
1063
1097
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* Bismillah */
|
|
2
|
-
"use strict";const SmartTableDefaults={key:"0",titleHeight:50,itemHeight:40,infoHeight:50,itemLineCount:16,highlightTitle:!0,highlightLine:!0,invertColor:0,noDataFoundAlert:"No data found!",searchKeyword:"",searchTitleIndex:-1,showSearchTitleSelect:1,wheelScroll:0,allowHtml:0,showCellTooltip:1,allTitlesText:"ALL",canSelect:1,fitLineCount:0,locale:"",sortByTitleIndex:0,sortDirection:"A-Z",fillTestData:0,onSelect:function(t,e){},createCellView:null,updateCellView:null,titleDataList:[{name:"ID",dataTitle:"id",dataType:"integer",width:100,sortable:1},{name:"NAME",dataTitle:"name",dataType:"string",width:100,sortable:1},{name:"EMAIL",dataTitle:"email",dataType:"string",width:290,sortable:0},{name:"",dataTitle:"active",dataType:"boolean",width:40,sortable:0}],itemDataList:[{id:1,name:"Bugra",desc:"about",email:"emainil",active:1},{id:2,name:"Alper",desc:"about",email:"emainil",active:1},{id:3,name:"Murat",desc:"about",email:"emainil-3",active:1},{id:4,name:"Deniz",desc:"about",email:"emainil",active:1},{id:5,name:"Nilüfer",desc:"about",email:"emainil-7",active:1},{id:6,name:"Frank",desc:"about",email:"emainil",active:1},{id:7,name:"Dany",desc:"about",email:"emainil-45",active:1},{id:8,name:"Duygu",desc:"about",email:"emainil",active:1},{id:9,name:"Filiz",desc:"about",email:"emainil-356",active:1},{id:10,name:"Anka",desc:"about",email:"emainil",active:1}],scrollBarParams:{bar_border:0,bar_round:3,bar_borderColor:"rgba(0, 0, 0, 1)",bar_width:4,bar_mouseOverWidth:4,bar_mouseOverColor:"#373836",bar_opacity:.4,bar_mouseOverOpacity:.9,bar_padding:2,bar_color:"#373836",neverHide:0,showDots:0},searchTitleMenuParams:{},searchInputParams:{styleName:"ozden",width:"50%",height:36,fontSize:15,searchIconSize:16,searchIconOpacity:.5,placeholder:"Filter",searchIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" preserveAspectRatio="none" fill="#000000"><rect x="0" y="85" width="512" height="57"/><rect x="85" y="227" width="342" height="56"/><rect x="199" y="370" width="114" height="57"/></svg>'),clearIconMinTextWidth:80,clearOnEscape:1},styleName:"light",style:{width:"auto",height:"auto",round:6,line1Color:"white",line2Color:"#F7F7F7",highlightItemCellColor:"#FFFAEB",selectedItemCellColor:"#FFF4D3",selectedBar:{width:0,color:"rgba(95, 158, 160, 0.9)"},focusRingColor:"rgba(95, 158, 160, 0.6)",highlightTitleCellColor:"white",titleUppercase:1,verticalScrollWidth:20,verticalScrollMargin:2,btnScrollDownIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 200" preserveAspectRatio="none" fill="none" stroke="#141414" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 84V116M27 103L40 116L53 103"/></svg>'),btnScrollUpIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 200" preserveAspectRatio="none" fill="none" stroke="#141414" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 116V84M27 97L40 84L53 97"/></svg>'),btnScrollCenterIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 50" fill="none" stroke="#000000" stroke-opacity="0.4" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M10 17.5v15M6.5 21 10 17.5 13.5 21M6.5 29 10 32.5 13.5 29"/></svg>'),sortIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.71,9.88l-4.3-4.29a2,2,0,0,0-2.82,0L6.29,9.88a1,1,0,0,0,0,1.41,1,1,0,0,0,1.42,0L11,8V19a1,1,0,0,0,2,0V8l3.29,3.29a1,1,0,1,0,1.42-1.41Z"/></svg>'),loadingIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" preserveAspectRatio="none"><circle cx="256" cy="256" r="206" fill="#FFFFFF" stroke="#141414" stroke-width="20"/><path d="M256 113V256H358" fill="none" stroke="#141414" stroke-width="20" stroke-linecap="round" stroke-linejoin="round"/></svg>'),searchTitleCheckIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#373836" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5 10 17.5 19 7"/></svg>'),invertIconColor:0,sortIcon:{size:16,opacity:.25,activeOpacity:1},cellTooltip:{fontSize:14,color:"white",textColor:Black(.8),round:6,border:1,borderColor:Black(.15),shadow:"0 6px 16px "+Black(.12),arrow:10,padding:[12,8],maxWidth:360},box:{color:"white"},boxBorder:{border:1,borderColor:Black(.15)},boxTitleLine:{color:"whitesmoke"},boxTitleCell:{padding:[10,0],borderRight:"1px solid "+Black(.08),borderBottom:"1px solid "+Black(.2)},lblTitleCell:{fontSize:15,fontFamily:"opensans-bold",textColor:Black(.8)},boxItemCell:{borderBottom:"1px solid "+Black(.08),borderRight:"none",padding:[10,0]},lblItemCell:{fontSize:15,textColor:Black(.7),fontFamily:"opensans"},boxInfoLine:{color:"white",borderTop:"1px solid "+Black(.2)},lblBoxInfoLine:{fontSize:14,textColor:Black(.5)},lblNoDataFound:{color:"transparent",textColor:Black(.45),padding:[8,2],fontSize:15,round:8,border:0,borderColor:"transparent"},lblSearchTitle:{color:"white",textColor:Black(.6),padding:[8,2],fontSize:12,round:50,border:1,borderColor:Black(.12)},btnScrollCenter:{color:"white",round:100,border:1,borderColor:Black(.2)},btnScrollUp:{color:"whitesmoke",round:100,border:1,borderColor:Black(.15)},btnScrollDown:{color:"whitesmoke",round:100,border:1,borderColor:Black(.15)},boxSort:{color:"transparent"}}},SmartTable=function(t={}){basic.applyStylePackage(t,SmartTable.styles,SmartTableDefaults),mergeIntoIfMissing(t,SmartTableDefaults);let e=startObject(t);e.titleDataList=e.titleDataList.map(t=>({...t})),e.itemDataList=[...e.itemDataList];const o=100,l="tr-TR",r=e.itemHeight;let i=0,n=null,a=null,c=null;const s=function(t,o){const l=null==o?"":String(o);1==e.allowHtml?t.text=l:t.plainText=l},d=function(){return Math.max(0,e.visibleItemDataList.length-e.itemLineCount)},h=function(t){return t<0?0:Math.min(t,d())},u=function(t){return"number"==typeof t?t:"string"==typeof t&&""!==t.trim()?Number(t):NaN};e.state="normal",e.visibleItemDataList=[...e.itemDataList],e.searchInput=null,e.selectedItemData=null,e.titleCellList=[],e.titleCellCount=0,e.itemLineList=[],e.startedItemIndexForScrolling=0,e.scrollVars={},e.recalcItemHeight=0,e.resizeTimer=null,e.refreshTimer=null,e.filterTimer=null,e.setState=function(t){e.state=t};const m=function(){};e.refresh=function(t=3){e.refreshTimer=waitAndRun(e.refreshTimer,m,t)};const g=e.remove;e.superRemove=g,e.remove=function(){e&&(clearTimeout(e.resizeTimer),clearTimeout(e.refreshTimer),clearTimeout(e.filterTimer),e.searchTitleMenu&&e.searchTitleMenu.remove(),D(),g.call(e),e=null)};const b=function(t){t.opacity=0,t.clickable=0,t.cursor="",t.itemData=null,S(t)},f=function(t,o){t.opacity=1,t.clickable=1,t.cursor="pointer",t.itemData=o,S(t);for(let l=0;l<e.titleCellCount;l++){const r=e.titleDataList[l],i=t["itemCell"+l],n=o[r.dataTitle]??"";"lastValue"in i&&i.lastValue===n||(i.lastValue=n,s(i.label,n)),e.updateCellView&&e.updateCellView(i,l,n,e)}};e.refreshData=function(){const t=e.startedItemIndexForScrolling,o=e.visibleItemDataList,l=e.itemLineCount;for(let r=0;r<l;r++){const l=e.itemLineList[r],i=o[t+r];i?f(l,i):b(l)}e.setVerticalScrollEnabled(o.length>l),e.updateInfoLabel(),k()};const p=function(t,e,o){t.opacity=e,t.clickable=o};e.setVerticalScrollEnabled=function(t){if(t&&e.visibleItemDataList.length>e.itemLineCount)return p(e.btnScrollCenter,1,1),p(e.btnScrollUp,1,1),void p(e.btnScrollDown,1,1);p(e.btnScrollCenter,0,0),p(e.btnScrollUp,.5,0),p(e.btnScrollDown,.5,0)},e.setTitleCellWidth=function(t,o){t<0||t>=e.titleCellCount||(e.titleCellList[t].width=o,e.titleDataList[t].width=o,e.itemLineList.forEach(function(e){e["itemCell"+t].width=o}))},e.createTitleLine=function(){e.titleCellList=[],e.boxTitleLine.html="",e.titleDataList.forEach(function(t,o){const l=e.createTitleCell(t,o);e.titleCellList.push(l),e.boxTitleLine.add(l)}),e.titleCellCount=e.titleCellList.length},e.setTitleDataList=function(t){e.titleDataList=t.map(t=>({...t})),e.createTitleLine(),e.createItemLines(),e.recalcItemHeight&&e.setItemHeight(e.itemHeight),e.stretchLastCell(e.calcLastCellWidth()),e.titleDataList[e.sortByTitleIndex]||(e.sortByTitleIndex=0),e.updateSortIcon(),e.updateSearchTitleSelect(),e.filterAndSortData()},e.createSortIcon=function(t){const o=e.style.sortIcon.size;startBox({align:"right center",color:e.style.boxSort.color,round:100,border:0,borderColor:"rgba(0,0,0,0.1)",width:o,height:o,right:2,padding:[4,0],position:"absolute"}),0==t.sortable&&(that.opacity=0),t.add(that),that.center("top"),t.icon=Icon({width:o,height:o,left:0,top:0,opacity:e.style.sortIcon.opacity}),that.setMotion("opacity 0.3s, transform 0.3s"),that.load(e.style.sortIconFile),1==e.style.invertIconColor&&(that.css.filter="invert(100%)"),that.center(),endBox()},e.resetSortIcons=function(t){e.titleCellList.forEach(function(o,l){l!=t.titleCellIndex&&(o.icon.rotate=0,o.icon.opacity=e.style.sortIcon.opacity,o.sortDirection="")})},e.createTitleCell=function(t,l){const r=AutoLayout({flow:"horizontal",align:"center left",width:t.width||o,padding:e.style.boxTitleCell.padding,height:e.titleHeight,color:"transparent",border:0,position:"relative"});return that.css={borderRight:e.style.boxTitleCell.borderRight,borderBottom:e.style.boxTitleCell.borderBottom},that.cursor="pointer",that.titleCellIndex=l,that.titleDataTitle=t.dataTitle,that.sortable=t.sortable,r.label=Label({...e.style.lblTitleCell}),s(r.label,t.name),that.css.fontFamily=e.style.lblTitleCell.fontFamily,1==e.style.titleUppercase&&(that.css.textTransform="uppercase"),endAutoLayout(),e.createSortIcon(r),r.on("click",function(t,o){1==t.sortable&&(e.resetSortIcons(t),e.sortByTitleIndex=t.titleCellIndex,e.sortDirection="A-Z"!=t.sortDirection?"A-Z":"Z-A",e.updateSortIcon(),e.filterAndSortData())}),r.on("mouseover",function(t,o){e.applyColumnHighlight(t)}),r.on("mouseout",function(t,o){e.clearColumnHighlight(t)}),r},e.updateSortIcon=function(){const t=e.titleCellList[e.sortByTitleIndex];t&&("A-Z"==e.sortDirection?(t.sortDirection="A-Z",t.icon.rotate=0):(t.sortDirection="Z-A",t.icon.rotate=180),t.icon.opacity=e.style.sortIcon.activeOpacity)};const C=function(t,o,l){t.color=o,e.itemLineList.forEach(function(e){e["itemCell"+t.titleCellIndex].color=l})};e.clearColumnHighlight=function(t){e.highlightTitle&&(C(t,"transparent","transparent"),e.itemLineList.forEach(S))},e.applyColumnHighlight=function(t){e.highlightTitle&&C(t,e.style.highlightTitleCellColor,e.style.highlightItemCellColor)},e.createItemLines=function(){T(null),e.itemLineList.forEach(function(t){t.remove()}),e.itemLineList=[];for(let t=0;t<e.itemLineCount;t++){const o=t,l=e.createItemLine(e.itemDataList[t],o);e.itemLineList.push(l),e.boxItemLineGroup.add(l)}},e.createItemLine=function(t,o){const l=HGroup({height:e.itemHeight||100,width:"auto",align:"top left",padding:[0,0],gap:0,color:o%2?e.style.line2Color:e.style.line1Color,position:"relative"});return e.titleDataList.forEach(function(t,o){l["itemCell"+o]=e.createItemCell(t.width,o,l)}),endGroup(),l.on("click",function(t){t.itemData&&(1==e.canSelect&&(e.selectItem(t.itemData),e.elem.focus({preventScroll:!0})),e.onSelect(e,t.itemData))}),"auto"!=e.style.height&&(l.visible=0),l};const S=function(t){const o=Boolean(t.itemData)&&t.itemData===e.selectedItemData;let l="transparent";t.isHover&&e.highlightLine&&(l=e.style.highlightItemCellColor),o&&(l=I()),function(t,o){for(let l=0;l<e.titleCellCount;l++)t["itemCell"+l].color=o}(t,l);const r=t.itemCell0;r&&(r.boxShadow=o?x():"none")},x=function(){if(!e.style.selectedBar.width)return"none";return"inset "+((basic.num(e.style.boxBorder.border)||0)+e.style.selectedBar.width)+"px 0 0 "+e.style.selectedBar.color},I=function(){return e.style.selectedItemCellColor||e.style.highlightItemCellColor},T=function(t){n=t,w()},w=function(){D(),n&&1==e.showCellTooltip&&(c=e.after(300,L))},L=function(){c=null;const t=y(n);"undefined"!=typeof Tooltip?t&&(a=Tooltip.show(n,t,e.style.cellTooltip,"top",function(e){v(t,e.look)}),a.cellText=t):n.elem.title=t},y=function(t){if(!t.itemLine.itemData)return"";const e=t.label.elem;return e.scrollWidth<=e.clientWidth?"":e.textContent},v=function(t,e){Label({plainText:t,fontSize:e.fontSize,textColor:e.textColor,css:{whiteSpace:"normal",overflowWrap:"anywhere",width:"max-content",maxWidth:e.maxWidth+"px"}})},D=function(){c&&c(),c=null,a&&a.remove(),a=null},k=function(){n&&(a&&a.cellText===n.label.elem.textContent||w())};e.setShowCellTooltip=function(t){e.showCellTooltip=basic.isOn(t)?1:0,w()},e.createItemCell=function(t,l,r){let i=AutoLayout({align:"center left",width:t||o,padding:e.style.boxItemCell.padding,height:"100%",color:"transparent",border:0});return that.css={borderBottom:e.style.boxItemCell.borderBottom,borderRight:e.style.boxItemCell.borderRight},i.label=Label({text:"",...e.style.lblItemCell}),that.css={whiteSpace:"nowrap",textOverflow:"ellipsis",fontFamily:e.style.lblItemCell.fontFamily},endAutoLayout(),i.on("mouseover",function(t,e){r.isHover=1,S(r)}),i.on("mouseout",function(t,e){r.isHover=0,S(r)}),i.itemLine=r,i.onHoverChange(function(t,e){!function(t,e){e?T(t):n===t&&T(null)}(i,e)}),e.createCellView&&createIn(i,function(){e.createCellView(i,l,e)}),i},e.initScrollMetrics=function(){e.scrollVars.minY=e.titleHeight,e.scrollVars.scrollAreaHeight=e.height-e.titleHeight-e.infoHeight,e.scrollVars.scrollIconHeight=e.btnScrollCenter.height,e.scrollVars.maxY=e.scrollVars.minY+e.scrollVars.scrollAreaHeight-e.scrollVars.scrollIconHeight,e.scrollVars.totalPath=e.scrollVars.maxY-e.scrollVars.minY,e.scrollVars.isDragging=!1,e.scrollVars.startY=0,e.scrollVars.startTop=0},e.syncScrollPosition=function(){const t=d();if(0===t)return;const o=e.startedItemIndexForScrolling/t;e.btnScrollCenter.top=e.scrollVars.minY+o*e.scrollVars.totalPath},e.createScrollEvents=function(){e.btnScrollCenter.clickable=1,e.btnScrollCenter.elem.setAttribute("draggable","false"),e.btnScrollCenter.cursor="grab",e.initScrollMetrics(),e.on("wheel",function(t,o){if(1!=e.wheelScroll)return;if(Math.abs(o.deltaX)>Math.abs(o.deltaY))return;o.preventDefault();const l=o.deltaY>0?1:-1,r=h(e.startedItemIndexForScrolling+l);r!==e.startedItemIndexForScrolling&&(e.startedItemIndexForScrolling=r,e.syncScrollPosition(),e.refreshData())},{passive:!1}),e.btnScrollCenter.on("mousedown",function(t,o){e.scrollVars.isDragging=!0,e.scrollVars.startY=o.clientY,e.scrollVars.startTop=e.btnScrollCenter.top,e.btnScrollCenter.cursor="grabbing",document.body.style.userSelect="none"}),e.listenTo(window,"mousemove",function(t,e){B(e)}),e.listenTo(window,"mouseup",function(){F()})};const B=function(t){if(!e||!e.scrollVars.isDragging)return;const o=t.clientY-e.scrollVars.startY;let l=e.scrollVars.startTop+o;if(l<e.scrollVars.minY&&(l=e.scrollVars.minY),l>e.scrollVars.maxY&&(l=e.scrollVars.maxY),e.btnScrollCenter.top=l,e.scrollVars.totalPath<=0)return;const r=(l-e.scrollVars.minY)/e.scrollVars.totalPath,i=Math.round(r*d());i!==e.startedItemIndexForScrolling&&(e.startedItemIndexForScrolling=i,e.refreshData())},F=function(){e&&e.scrollVars.isDragging&&(e.scrollVars.isDragging=!1,e.btnScrollCenter.cursor="grab",document.body.style.userSelect="auto")};e.getSelectedIndex=function(){return e.selectedItemData?e.visibleItemDataList.indexOf(e.selectedItemData):-1},e.selectItem=function(t){1==e.canSelect&&(e.selectedItemData=t||null,A(),e.refreshData())},e.clearSelection=function(){e.selectItem(null)},e.setCanSelect=function(t){e.canSelect=basic.isOn(t)?1:0,1!=e.canSelect&&(e.selectedItemData=null),M(),e.refreshData()};const M=function(){e.tabIndex=1==e.canSelect?0:null,1!=e.canSelect&&e.elem.blur()},R=function(){const t=e.elem.matches(":focus-visible");e.boxBorder.css.outline=t?"2px solid "+e.style.focusRingColor:"none",e.boxBorder.css.outlineOffset="-2px"},A=function(){const t=e.getSelectedIndex();if(-1==t)return;let o=e.startedItemIndexForScrolling;t<o&&(o=t),t>=o+e.itemLineCount&&(o=t-e.itemLineCount+1),e.startedItemIndexForScrolling=h(o),e.syncScrollPosition()};e.scrollPage=function(t){const o=h(e.startedItemIndexForScrolling+t*e.itemLineCount);o!==e.startedItemIndexForScrolling&&(e.startedItemIndexForScrolling=o,e.refreshData(),e.syncScrollPosition())},e.updateInfoLabel=function(){const t=e.visibleItemDataList.length;if(0==t)return e.boxInfoLine.label.text="0 - 0 / 0",void(e.lblNoDataFound.opacity=1);e.lblNoDataFound.opacity=0;const o=e.startedItemIndexForScrolling+1;let l=e.startedItemIndexForScrolling+e.itemLineCount;l>t&&(l=t),e.boxInfoLine.label.text=`${V(o)} - ${V(l)} / ${V(t)}`};const V=function(t){try{return t.toLocaleString(e.locale||document.documentElement.lang||l)}catch(e){return t.toLocaleString(l)}};e.setLocale=function(t){e.locale=t,e.updateInfoLabel()},e.setScrollToTop=function(){e.startedItemIndexForScrolling=0,e.btnScrollCenter.top=e.scrollVars.minY},e.setItemDataList=function(t){e.itemDataList=[...t],e.filterAndSortData()};const H=function(t,o){if(""===o)return t;const l=e.titleDataList[e.searchTitleIndex],r=l?[l]:e.titleDataList;return t.filter(t=>r.some(e=>function(t,e){return null!=t&&SmartTable.toSearchText(t).includes(e)}(t[e.dataTitle],o)))},z=function(t,o,l){const r=e.titleDataList[o];if(!r||0===r.sortable)return;const i=r.dataTitle;t.sort((t,e)=>{const o=function(t,e){const o=u(t),l=u(e);return Number.isFinite(o)&&Number.isFinite(l)?o-l:String(t).localeCompare(String(e),"tr")}(t[i]??"",e[i]??"");return"A-Z"===l?o:-o})};e.filterAndSortData=function(){e.itemDataList.length>1e3&&e.showLoading(1),e.filterTimer=waitAndRun(e.filterTimer,function(){e.filterTimer=null;const t=SmartTable.toSearchText(e.searchKeyword??"").trim(),o=H([...e.itemDataList],t);z(o,e.sortByTitleIndex,e.sortDirection),e.visibleItemDataList=o,e.setScrollToTop(),-1==e.getSelectedIndex()&&(e.selectedItemData=null),A(),e.refreshData(),e.showLoading(0)},50)},e.generateTestData=function(){let t=[];for(let o=0;o<1e5;o++){const o=e.itemDataList.map(e=>({...e,id:t.length+e.id}));t.push(...o)}e.itemDataList=t,e.visibleItemDataList=t,console.log("Yeni veri sayısı:",e.visibleItemDataList.length)},e.createVerticalScroll=function(){const t=e.style.verticalScrollWidth,o=-1*(t+e.style.verticalScrollMargin);e.btnScrollCenter=startBox(0,0,t,50,{right:o,top:e.titleHeight,opacity:0,clickable:0,...e.style.btnScrollCenter}),Icon(0,0,"100%","100%"),that.load(e.style.btnScrollCenterIconFile),endBox(),e.btnScrollUp=Box(0,0,t,e.titleHeight,{right:o,...e.style.btnScrollUp}),that.cursor="pointer",that.on("click",function(t,o){e.scrollPage(-1)}),Icon(0,0,"100%","100%"),e.btnScrollUp.add(that),that.load(e.style.btnScrollUpIconFile),1==e.style.invertIconColor&&(that.css.filter="invert(100%)"),e.btnScrollDown=Box(0,0,t,e.infoHeight,{right:o,bottom:0,...e.style.btnScrollDown}),that.cursor="pointer",that.on("click",function(t,o){e.scrollPage(1)}),Icon(0,0,"100%","100%"),e.btnScrollDown.add(that),that.load(e.style.btnScrollDownIconFile),1==e.style.invertIconColor&&(that.css.filter="invert(100%)")};const N=function(){const t=e.lblSelectedSortKey.elem.offsetWidth,o=t>0;e.searchInput.setClearIconRight(o?6+t+6:i)};e.createToolbar=function(){HGroup({align:"left center",gap:12,padding:[8,0]}),e.boxInfoLine.add(that),e.searchInput=SearchInput(e.searchInputParams),that.setValue(e.searchKeyword,1),that.onEnter=function(t){e.searchKeyword=t.getSearchText(),e.filterAndSortData()},i=that.clearIconRight,function(){const t=String(e.searchInputParams.width);e.searchInput.css.minWidth="0px",t.endsWith("%")&&(e.searchInput.css.flexGrow="1",e.searchInput.css.maxWidth="max("+t+", 240px)")}(),e.boxInfoLine.label=Label({text:"0 - 0 / 0",...e.style.lblBoxInfoLine}),that.css={marginLeft:"auto",marginRight:"6px",flexShrink:"0"},endGroup(),e.lblSelectedSortKey=createIn(e.searchInput,function(){return Label({right:6,opacity:1,clickable:1,...e.style.lblNoDataFound,...e.style.lblSearchTitle})}),s(e.lblSelectedSortKey,e.allTitlesText),that.cursor="pointer",that.ellipsis=1,that.css.maxWidth="160px",that.css.top="50%",that.css.transform="translateY(-50%)",that.setMotion("opacity 0.2s"),that.onResize(N),"function"==typeof ContextMenu?(e.searchTitleMenu=ContextMenu({minWidth:160,...e.searchTitleMenuParams,onClick:function(t,o){e.setSearchTitleIndex(o.data)}}),e.searchTitleMenu.attachTo(e.lblSelectedSortKey,"click")):e.lblSelectedSortKey.on("click",function(){e.selectNextSearchTitle()})},e.stretchLastCell=function(t){if(!(t>0)||0==e.titleCellCount)return;const o=e.titleCellCount-1;e.itemLineList.forEach(function(e){e["itemCell"+o].width=t}),e.titleCellList[o].width=t},e.calcLastCellWidth=function(){const t=e.titleDataList,l=e.width;if(0==t.length)return 0;let r=0;t.forEach(function(t){r+=basic.num(t.width||o)});const i=basic.num(t[t.length-1].width||o);return l>r?l-r+i:i},e.setItemHeight=function(t){e.itemHeight=t,e.itemLineList.forEach(function(t){t.height=e.itemHeight,t.visible=1})},e.setHeight=function(t){e.recalcItemHeight="auto"!=t?1:0,e.height=t},e.setWidth=function(t){if(!("string"==typeof t&&t.includes("%")))return e.width=t,void(e.css={marginRight:e.getVerticalScrollWidth()+"px"});e.css.marginRight&&(e.css={marginRight:""}),e.width="calc("+t+" - "+e.getVerticalScrollWidth()+"px)"},e.getTotalWidth=function(){return e.width+e.getVerticalScrollWidth()},e.getVerticalScrollWidth=function(){return e.style.verticalScrollWidth+e.style.verticalScrollMargin},e.createLoading=function(){e.boxLoading=VGroup({color:Black(.3),clickable:1,round:e.style.round}),e.add(e.boxLoading),Icon({width:32,height:32}),that.load(e.style.loadingIconFile),endGroup()},e.showLoading=function(t){t?(e.boxLoading.visible=1,e.setVerticalScrollEnabled(!1)):(e.boxLoading.visible=0,e.setVerticalScrollEnabled(!0))},e.createNoDataFoundLabel=function(){HGroup(),e.lblNoDataFound=Label({opacity:0,...e.style.lblNoDataFound}),s(e.lblNoDataFound,e.noDataFoundAlert),that.setMotion("opacity 0.2s"),endGroup()};const E=function(t){return String(t.name??"").replace(/<[^>]*>/g,"").trim()||String(t.dataTitle??"")};e.updateSearchTitleSelect=function(){e.titleDataList[e.searchTitleIndex]||(e.searchTitleIndex=-1);const t=e.titleDataList[e.searchTitleIndex];if(s(e.lblSelectedSortKey,t?E(t):e.allTitlesText),e.lblSelectedSortKey.visible=1==e.showSearchTitleSelect?1:0,!e.searchTitleMenu)return;const o=function(t){return e.searchTitleIndex==t?e.style.searchTitleCheckIconFile:""},l=[{text:e.allTitlesText,data:-1,iconFile:o(-1)},"-"];e.titleDataList.forEach(function(t,e){l.push({text:E(t),data:e,iconFile:o(e)})}),e.searchTitleMenu.setItems(l),1!=e.showSearchTitleSelect&&e.searchTitleMenu.close()},e.setSearchTitleIndex=function(t){e.searchTitleIndex=e.titleDataList[t]?t:-1,e.updateSearchTitleSelect(),""!==String(e.searchKeyword??"").trim()&&e.filterAndSortData()},e.selectNextSearchTitle=function(){const t=e.searchTitleIndex+1;e.setSearchTitleIndex(t<e.titleDataList.length?t:-1)},e.setShowSearchTitleSelect=function(t){e.showSearchTitleSelect=basic.isOn(t)?1:0,e.updateSearchTitleSelect()},e.setWheelScroll=function(t){e.wheelScroll=basic.isOn(t)?1:0};const W=function(){return e.height-e.titleHeight-e.infoHeight},O=function(){if(e.recalcItemHeight&&1==e.fitLineCount)P();else if(e.recalcItemHeight){const t=W()/e.itemLineCount;(e.itemHeight!=t||e.itemLineList[0]&&!e.itemLineList[0].visible)&&e.setItemHeight(t)}e.stretchLastCell(e.calcLastCellWidth()),e.initScrollMetrics(),e.syncScrollPosition(),e.scrollBar.refreshScroll(),e.refreshData()},P=function(){const t=W();if(t<=0)return;const o=Math.max(1,Math.round(t/r));o==e.itemLineList.length?e.setItemHeight(t/o):e.setItemLineCount(o)};return e.setItemLineCount=function(t){e.itemLineCount=Math.max(1,Math.round(t)),e.createItemLines();const o=W(),l=e.recalcItemHeight&&o>0;e.setItemHeight(l?o/e.itemLineCount:e.itemHeight),e.stretchLastCell(e.calcLastCellWidth()),e.startedItemIndexForScrolling=h(e.startedItemIndexForScrolling),A(),e.initScrollMetrics(),e.syncScrollPosition(),e.refreshData()},e.setFitLineCount=function(t){e.fitLineCount=basic.isOn(t)?1:0,O()},e.createResizeEvent=function(){e.onResize(function(t){e.resizeTimer=waitAndRun(e.resizeTimer,O,3)})},e.init=function(){e.clickable=1,e.clipContent=0,e.color=e.style.box.color,e.round=e.style.round,1==e.invertColor&&(e.css.filter="invert(100%)"),e.setWidth(e.style.width),e.setHeight(e.style.height),e.boxHorizontalScrollable=VGroup({align:"top left",width:"auto",height:"auto",padding:[0,0],gap:0,position:"relative",clipContent:0,scrollX:1}),that.css={borderTopLeftRadius:e.style.round+"px",borderTopRightRadius:e.style.round+"px",borderBottomRightRadius:"0px",borderBottomLeftRadius:"0px",marginBottom:e.infoHeight+"px"},e.boxTitleLine=HGroup({height:"auto",width:"auto",align:"top left",padding:[0,0],gap:0,color:e.style.boxTitleLine.color}),endGroup(),e.boxItemLineGroup=VGroup({align:"top left",width:"auto",height:"auto",padding:[0,0],gap:0}),endGroup(),endGroup(),e.boxInfoLine=HGroup({bottom:0,left:0,height:e.infoHeight,width:"100%",align:"top left",padding:[0,0],gap:0,...e.style.boxInfoLine}),endGroup(),that.css={borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomRightRadius:e.style.round+"px",borderBottomLeftRadius:e.style.round+"px",borderTop:e.style.boxInfoLine.borderTop},that.clickable=0,e.createToolbar(),e.createNoDataFoundLabel(),e.boxBorder=Box(0,0,"100%","100%",e.style.boxBorder),that.round=e.style.round,that.color="transparent",e.createVerticalScroll(),e.scrollBar=ScrollBar({scrollableBox:e.boxHorizontalScrollable,...e.scrollBarParams}),e.createResizeEvent(),e.createLoading()},e.init(),e.createTitleLine(),e.createItemLines(),e.createScrollEvents(),e.on("keydown",function(t,o){if(1!=e.canSelect||o.target!=e.elem)return;if(o.metaKey||o.ctrlKey||o.altKey)return;if("Enter"==o.key)return void(e.selectedItemData&&e.onSelect(e,e.selectedItemData));const l=function(t){const o=e.itemLineCount,l=e.visibleItemDataList.length;return{ArrowDown:1,ArrowUp:-1,PageDown:o,PageUp:-o,Home:-l,End:l}[t]||0}(o.key);0!=l&&(o.preventDefault(),function(t){const o=e.visibleItemDataList.length;if(0==o)return;let l=e.getSelectedIndex();-1==l&&(l=t>0?-1:o),e.selectItem(e.visibleItemDataList[basic.clamp(l+t,0,o-1)])}(l),R())}),e.on("focus",R),e.on("blur",R),M(),e.stretchLastCell(e.calcLastCellWidth()),e.updateSortIcon(),e.updateSearchTitleSelect(),e.fillTestData&&e.generateTestData(),e.filterAndSortData(),endObject(e)};SmartTable.toSearchText=function(t){const e=String(t).toLocaleLowerCase("tr");return SmartTable.NOT_ASCII.test(e)?e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/ı/g,"i"):e},SmartTable.NOT_ASCII=/[^\u0000-\u007f]/,SmartTable.styles={light:{style:{}},dark:{style:{line1Color:"#232428",line2Color:"#27292D",highlightItemCellColor:"#2E3035",selectedItemCellColor:"#24383A",focusRingColor:"rgba(95, 179, 181, 0.7)",highlightTitleCellColor:"#33353A",btnScrollCenterIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 50" fill="none" stroke="#FFFFFF" stroke-opacity="0.5" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M10 17.5v15M6.5 21 10 17.5 13.5 21M6.5 29 10 32.5 13.5 29"/></svg>'),searchTitleCheckIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#E6E6E6" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5 10 17.5 19 7"/></svg>'),invertIconColor:1,sortIcon:{size:16,opacity:.3,activeOpacity:1},cellTooltip:{color:"#2B2D31",textColor:"rgba(255, 255, 255, 0.88)",borderColor:"rgba(255, 255, 255, 0.14)",shadow:"0 8px 24px rgba(0, 0, 0, 0.5)"},box:{color:"#232428"},boxBorder:{border:1,borderColor:"rgba(255, 255, 255, 0.12)"},boxTitleLine:{color:"#2B2D31"},boxTitleCell:{borderRight:"1px solid rgba(255, 255, 255, 0.08)",borderBottom:"1px solid rgba(255, 255, 255, 0.14)"},lblTitleCell:{textColor:"rgba(255, 255, 255, 0.85)"},boxItemCell:{borderBottom:"1px solid rgba(255, 255, 255, 0.06)"},lblItemCell:{textColor:"rgba(255, 255, 255, 0.75)"},boxInfoLine:{color:"#232428",borderTop:"1px solid rgba(255, 255, 255, 0.14)"},lblBoxInfoLine:{textColor:"rgba(255, 255, 255, 0.5)"},lblNoDataFound:{textColor:"rgba(255, 255, 255, 0.45)"},lblSearchTitle:{color:"#33353A",textColor:"rgba(255, 255, 255, 0.7)",borderColor:"rgba(255, 255, 255, 0.14)"},btnScrollCenter:{color:"#2B2D31",borderColor:"rgba(255, 255, 255, 0.2)"},btnScrollUp:{color:"#2B2D31",borderColor:"rgba(255, 255, 255, 0.14)"},btnScrollDown:{color:"#2B2D31",borderColor:"rgba(255, 255, 255, 0.14)"}},searchInputParams:{styleName:"ozdenDark"},scrollBarParams:{bar_color:"#A0A0A0",bar_mouseOverColor:"#D0D0D0"},searchTitleMenuParams:{styleName:"dark"}},green:{style:{width:"auto",height:"auto",round:6,line1Color:"white",line2Color:"whitesmoke",highlightItemCellColor:"#F3E7C2",selectedItemCellColor:null,selectedBar:{width:3,color:"rgba(95, 158, 160, 0.9)"},focusRingColor:"rgba(95, 158, 160, 0.6)",highlightTitleCellColor:White(.2),titleUppercase:0,verticalScrollWidth:20,verticalScrollMargin:2,btnScrollDownIconFile:SmartTableDefaults.style.btnScrollDownIconFile,btnScrollUpIconFile:SmartTableDefaults.style.btnScrollUpIconFile,btnScrollCenterIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 200" preserveAspectRatio="none" fill="none" stroke="#D96450" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 28V172M27 41L40 28L53 41M27 159L40 172L53 159"/></svg>'),sortIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" preserveAspectRatio="none" fill="none" stroke="#141414" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 24V56M27 43L40 56L53 43"/></svg>'),loadingIconFile:SmartTableDefaults.style.loadingIconFile,searchTitleCheckIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#373836" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5 10 17.5 19 7"/></svg>'),invertIconColor:0,sortIcon:{size:22,opacity:.5,activeOpacity:1},box:{color:"white"},boxBorder:{border:2,borderColor:Black(.8)},boxTitleLine:{color:"#65A293"},boxTitleCell:{padding:[8,0],borderRight:"1px solid rgba(0, 0, 0, 0.5)",borderBottom:"2px solid #141414"},lblTitleCell:{fontSize:20,fontFamily:"opensans",textColor:Black(.8)},boxItemCell:{borderBottom:"1px solid darkgray",borderRight:"1px solid rgba(0, 0, 0, 0.05)",padding:[8,0]},lblItemCell:{fontSize:20,textColor:Black(.75),fontFamily:"opensans"},boxInfoLine:{color:"#E4E4E4",borderTop:"1px solid rgba(0, 0, 0, 0)"},lblBoxInfoLine:{fontSize:16,textColor:Black(.85)},lblNoDataFound:{color:"lightgray",textColor:Black(.8),padding:[8,2],fontSize:14,round:8,border:1,borderColor:Black(.4)},lblSearchTitle:{color:"whitesmoke",textColor:Black(.8),padding:[8,2],fontSize:14,round:8,border:1,borderColor:Black(.15)},btnScrollCenter:{color:"white",round:100,border:1,borderColor:"rgba(0,0,0,0.4)"},btnScrollUp:{color:"lightgray",round:100,border:1,borderColor:"rgba(0, 0, 0, 0.6)"},btnScrollDown:{color:"lightgray",round:100,border:1,borderColor:"rgba(0, 0, 0, 0.6)"},boxSort:{color:"#65A293"}},searchInputParams:{styleName:"original",width:"50%",height:36,border:1,round:8,color:"white",searchIconSize:16,placeholder:"Filter",fontSize:16,borderColor:Black(.15),borderBottomStyle:"1px solid "+Black(.15),searchIconFile:SmartTableDefaults.searchInputParams.searchIconFile,searchIconOpacity:.8}}},SmartTable.styles.classic=SmartTable.styles.light,SmartTable.createMinimalStyle=function(t){return{titleHeight:30,itemHeight:28,infoHeight:28,style:Object.assign({round:4,line1Color:t.ground,line2Color:t.ground,highlightItemCellColor:t.hover,selectedItemCellColor:t.selected,selectedBar:{width:2,color:t.ink},focusRingColor:t.focus,highlightTitleCellColor:t.ground,titleUppercase:0,invertIconColor:t.invertIcons,sortIcon:{size:14,opacity:.3,activeOpacity:1},cellTooltip:{fontSize:12,color:t.ground,textColor:t.text,round:4,border:1,borderColor:t.line,shadow:"none"},box:{color:t.ground},boxBorder:{border:1,borderColor:t.line},boxTitleLine:{color:t.ground},boxTitleCell:{padding:[10,0],borderRight:"none",borderBottom:"1px solid "+t.line},lblTitleCell:{fontSize:12,fontFamily:"opensans-bold",textColor:t.softText},boxItemCell:{borderBottom:"1px solid "+t.track,borderRight:"none",padding:[10,0]},lblItemCell:{fontSize:13,textColor:t.text,fontFamily:"opensans"},boxInfoLine:{color:t.ground,borderTop:"1px solid "+t.line},lblBoxInfoLine:{fontSize:12,textColor:t.softText},lblNoDataFound:{color:"transparent",textColor:t.softText,fontSize:12},lblSearchTitle:{color:"transparent",textColor:t.softText,fontSize:11,border:0,borderColor:"transparent"},btnScrollCenter:{color:t.ground,borderColor:t.line},btnScrollUp:{color:t.ground,borderColor:t.line},btnScrollDown:{color:t.ground,borderColor:t.line}},t.icons),searchInputParams:{styleName:t.minimalName,height:22,fontSize:12,searchIconSize:12,searchIconLeft:8},scrollBarParams:{bar_color:t.scrollBar,bar_mouseOverColor:t.scrollBar,bar_width:3},searchTitleMenuParams:{styleName:t.minimalName}}},SmartTable.MINIMAL_COLORS={ground:"#FFFFFF",text:Black(.85),softText:Black(.55),line:Black(.2),track:Black(.08),hover:Black(.03),selected:Black(.06),ink:"#1F1F1F",focus:"#3D8BD9",scrollBar:"#9A9A98",invertIcons:0,minimalName:"minimal",icons:{}},SmartTable.styles.minimal=SmartTable.createMinimalStyle(SmartTable.MINIMAL_COLORS),SmartTable.MINIMAL_DARK_COLORS={ground:"#1A1A19",text:White(.88),softText:White(.55),line:White(.18),track:White(.08),hover:White(.04),selected:White(.08),ink:"#EDEDEB",focus:"#7FB6DE",scrollBar:"#A0A0A0",invertIcons:1,minimalName:"minimalDark",icons:{btnScrollCenterIconFile:SmartTable.styles.dark.style.btnScrollCenterIconFile,searchTitleCheckIconFile:SmartTable.styles.dark.style.searchTitleCheckIconFile}},SmartTable.styles.minimalDark=SmartTable.createMinimalStyle(SmartTable.MINIMAL_DARK_COLORS);
|
|
2
|
+
"use strict";const SmartTableDefaults={key:"0",titleHeight:50,itemHeight:40,infoHeight:50,itemLineCount:16,highlightTitle:!0,highlightLine:!0,invertColor:0,noDataFoundAlert:"No data found!",searchKeyword:"",searchTitleIndex:-1,showSearchTitleSelect:1,wheelScroll:0,allowHtml:0,showCellTooltip:1,allTitlesText:"ALL",canSelect:1,fitLineCount:0,locale:"",sortByTitleIndex:0,sortDirection:"A-Z",fillTestData:0,onSelect:function(t,e){},createCellView:null,updateCellView:null,titleDataList:[{name:"ID",dataTitle:"id",dataType:"integer",width:100,sortable:1},{name:"NAME",dataTitle:"name",dataType:"string",width:100,sortable:1},{name:"EMAIL",dataTitle:"email",dataType:"string",width:290,sortable:0},{name:"",dataTitle:"active",dataType:"boolean",width:40,sortable:0}],itemDataList:[{id:1,name:"Bugra",desc:"about",email:"emainil",active:1},{id:2,name:"Alper",desc:"about",email:"emainil",active:1},{id:3,name:"Murat",desc:"about",email:"emainil-3",active:1},{id:4,name:"Deniz",desc:"about",email:"emainil",active:1},{id:5,name:"Nilüfer",desc:"about",email:"emainil-7",active:1},{id:6,name:"Frank",desc:"about",email:"emainil",active:1},{id:7,name:"Dany",desc:"about",email:"emainil-45",active:1},{id:8,name:"Duygu",desc:"about",email:"emainil",active:1},{id:9,name:"Filiz",desc:"about",email:"emainil-356",active:1},{id:10,name:"Anka",desc:"about",email:"emainil",active:1}],scrollBarParams:{bar_border:0,bar_round:3,bar_borderColor:"rgba(0, 0, 0, 1)",bar_width:4,bar_mouseOverWidth:4,bar_mouseOverColor:"#373836",bar_opacity:.4,bar_mouseOverOpacity:.9,bar_padding:2,bar_color:"#373836",neverHide:0,showDots:0},searchTitleMenuParams:{},searchInputParams:{styleName:"ozden",width:"50%",height:36,fontSize:15,searchIconSize:16,searchIconOpacity:.5,placeholder:"Filter",searchIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" preserveAspectRatio="none" fill="#000000"><rect x="0" y="85" width="512" height="57"/><rect x="85" y="227" width="342" height="56"/><rect x="199" y="370" width="114" height="57"/></svg>'),clearIconMinTextWidth:80,clearOnEscape:1},styleName:"light",style:{width:"auto",height:"auto",round:6,line1Color:"white",line2Color:"#F7F7F7",highlightItemCellColor:"#FFFAEB",selectedItemCellColor:"#FFF4D3",selectedBar:{width:0,color:"rgba(95, 158, 160, 0.9)"},focusRingColor:"rgba(95, 158, 160, 0.6)",highlightTitleCellColor:"white",titleUppercase:1,verticalScrollWidth:20,verticalScrollMargin:2,btnScrollDownIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 200" preserveAspectRatio="none" fill="none" stroke="#141414" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 84V116M27 103L40 116L53 103"/></svg>'),btnScrollUpIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 200" preserveAspectRatio="none" fill="none" stroke="#141414" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 116V84M27 97L40 84L53 97"/></svg>'),btnScrollCenterIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 50" fill="none" stroke="#000000" stroke-opacity="0.4" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M10 17.5v15M6.5 21 10 17.5 13.5 21M6.5 29 10 32.5 13.5 29"/></svg>'),sortIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.71,9.88l-4.3-4.29a2,2,0,0,0-2.82,0L6.29,9.88a1,1,0,0,0,0,1.41,1,1,0,0,0,1.42,0L11,8V19a1,1,0,0,0,2,0V8l3.29,3.29a1,1,0,1,0,1.42-1.41Z"/></svg>'),loadingIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" preserveAspectRatio="none"><circle cx="256" cy="256" r="206" fill="#FFFFFF" stroke="#141414" stroke-width="20"/><path d="M256 113V256H358" fill="none" stroke="#141414" stroke-width="20" stroke-linecap="round" stroke-linejoin="round"/></svg>'),searchTitleCheckIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#373836" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5 10 17.5 19 7"/></svg>'),invertIconColor:0,sortIcon:{size:16,opacity:.25,activeOpacity:1},cellTooltip:{fontSize:14,color:"white",textColor:Black(.8),round:6,border:1,borderColor:Black(.15),shadow:"0 6px 16px "+Black(.12),arrow:10,padding:[12,8],maxWidth:360},box:{color:"white"},boxBorder:{border:1,borderColor:Black(.15)},boxTitleLine:{color:"whitesmoke"},boxTitleCell:{padding:[10,0],borderRight:"1px solid "+Black(.08),borderBottom:"1px solid "+Black(.2)},lblTitleCell:{fontSize:15,fontFamily:"opensans-bold",textColor:Black(.8)},boxItemCell:{borderBottom:"1px solid "+Black(.08),borderRight:"none",padding:[10,0]},lblItemCell:{fontSize:15,textColor:Black(.7),fontFamily:"opensans"},boxInfoLine:{color:"white",borderTop:"1px solid "+Black(.2)},lblBoxInfoLine:{fontSize:14,textColor:Black(.5)},lblNoDataFound:{color:"transparent",textColor:Black(.45),padding:[8,2],fontSize:15,round:8,border:0,borderColor:"transparent"},lblSearchTitle:{color:"white",textColor:Black(.6),padding:[8,2],fontSize:12,round:50,border:1,borderColor:Black(.12)},btnScrollCenter:{color:"white",round:100,border:1,borderColor:Black(.2)},btnScrollUp:{color:"whitesmoke",round:100,border:1,borderColor:Black(.15)},btnScrollDown:{color:"whitesmoke",round:100,border:1,borderColor:Black(.15)},boxSort:{color:"transparent"}}},SmartTable=function(t={}){basic.applyStylePackage(t,SmartTable.styles,SmartTableDefaults),mergeIntoIfMissing(t,SmartTableDefaults);let e=startObject(t);e.titleDataList=e.titleDataList.map(t=>({...t})),e.itemDataList=[...e.itemDataList];const o=100,l="tr-TR",r=e.itemHeight;let i=0,n=null,a=null,c=null;const s=function(t,o){const l=null==o?"":String(o);1==e.allowHtml?t.text=l:t.plainText=l},d=function(){return Math.max(0,e.visibleItemDataList.length-e.itemLineCount)},h=function(t){return t<0?0:Math.min(t,d())},u=function(t){return"number"==typeof t?t:"string"==typeof t&&""!==t.trim()?Number(t):NaN},m=new Map,g=function(t,o){if(!t.numberFormat)return o;const r=u(o);if(!Number.isFinite(r))return o;const i=function(t){const o=t.locale||e.locale||document.documentElement.lang||l,r=o+" "+JSON.stringify(t);if(m.has(r))return m.get(r);let i=null;try{i=new Intl.NumberFormat(o,t)}catch(e){console.warn("SmartTable: numberFormat "+JSON.stringify(t)+": "+e.message)}return m.set(r,i),i}(t.numberFormat);return i?i.format(r):o};e.state="normal",e.visibleItemDataList=[...e.itemDataList],e.searchInput=null,e.selectedItemData=null,e.titleCellList=[],e.titleCellCount=0,e.itemLineList=[],e.startedItemIndexForScrolling=0,e.scrollVars={},e.recalcItemHeight=0,e.resizeTimer=null,e.refreshTimer=null,e.filterTimer=null,e.setState=function(t){e.state=t};const b=function(){};e.refresh=function(t=3){e.refreshTimer=waitAndRun(e.refreshTimer,b,t)};const f=e.remove;e.superRemove=f,e.remove=function(){e&&(clearTimeout(e.resizeTimer),clearTimeout(e.refreshTimer),clearTimeout(e.filterTimer),e.searchTitleMenu&&e.searchTitleMenu.remove(),B(),f.call(e),e=null)};const p=function(t){t.opacity=0,t.clickable=0,t.cursor="",t.itemData=null,I(t)},C=function(t,o){t.opacity=1,t.clickable=1,t.cursor="pointer",t.itemData=o,I(t);for(let l=0;l<e.titleCellCount;l++){const r=e.titleDataList[l],i=t["itemCell"+l],n=o[r.dataTitle]??"",a=g(r,n);"lastValue"in i&&i.lastValue===a||(i.lastValue=a,s(i.label,a)),e.updateCellView&&e.updateCellView(i,l,n,e)}};e.refreshData=function(){const t=e.startedItemIndexForScrolling,o=e.visibleItemDataList,l=e.itemLineCount;for(let r=0;r<l;r++){const l=e.itemLineList[r],i=o[t+r];i?C(l,i):p(l)}e.setVerticalScrollEnabled(o.length>l),e.updateInfoLabel(),F()};const S=function(t,e,o){t.opacity=e,t.clickable=o};e.setVerticalScrollEnabled=function(t){if(t&&e.visibleItemDataList.length>e.itemLineCount)return S(e.btnScrollCenter,1,1),S(e.btnScrollUp,1,1),void S(e.btnScrollDown,1,1);S(e.btnScrollCenter,0,0),S(e.btnScrollUp,.5,0),S(e.btnScrollDown,.5,0)},e.setTitleCellWidth=function(t,o){t<0||t>=e.titleCellCount||(e.titleCellList[t].width=o,e.titleDataList[t].width=o,e.itemLineList.forEach(function(e){e["itemCell"+t].width=o}))},e.createTitleLine=function(){e.titleCellList=[],e.boxTitleLine.html="",e.titleDataList.forEach(function(t,o){const l=e.createTitleCell(t,o);e.titleCellList.push(l),e.boxTitleLine.add(l)}),e.titleCellCount=e.titleCellList.length},e.setTitleDataList=function(t){e.titleDataList=t.map(t=>({...t})),e.createTitleLine(),e.createItemLines(),e.recalcItemHeight&&e.setItemHeight(e.itemHeight),e.stretchLastCell(e.calcLastCellWidth()),e.titleDataList[e.sortByTitleIndex]||(e.sortByTitleIndex=0),e.updateSortIcon(),e.updateSearchTitleSelect(),e.filterAndSortData()},e.createSortIcon=function(t){const o=e.style.sortIcon.size;startBox({align:"right center",color:e.style.boxSort.color,round:100,border:0,borderColor:"rgba(0,0,0,0.1)",width:o,height:o,right:2,padding:[4,0],position:"absolute"}),0==t.sortable&&(that.opacity=0),t.add(that),that.center("top"),t.icon=Icon({width:o,height:o,left:0,top:0,opacity:e.style.sortIcon.opacity}),that.setMotion("opacity 0.3s, transform 0.3s"),that.load(e.style.sortIconFile),1==e.style.invertIconColor&&(that.css.filter="invert(100%)"),that.center(),endBox()},e.resetSortIcons=function(t){e.titleCellList.forEach(function(o,l){l!=t.titleCellIndex&&(o.icon.rotate=0,o.icon.opacity=e.style.sortIcon.opacity,o.sortDirection="")})},e.createTitleCell=function(t,l){const r=AutoLayout({flow:"horizontal",align:"center left",width:t.width||o,padding:e.style.boxTitleCell.padding,height:e.titleHeight,color:"transparent",border:0,position:"relative"});return that.css={borderRight:e.style.boxTitleCell.borderRight,borderBottom:e.style.boxTitleCell.borderBottom},that.cursor="pointer",that.titleCellIndex=l,that.titleDataTitle=t.dataTitle,that.sortable=t.sortable,r.label=Label({...e.style.lblTitleCell}),s(r.label,t.name),that.css.fontFamily=e.style.lblTitleCell.fontFamily,1==e.style.titleUppercase&&(that.css.textTransform="uppercase"),endAutoLayout(),e.createSortIcon(r),r.on("click",function(t,o){1==t.sortable&&(e.resetSortIcons(t),e.sortByTitleIndex=t.titleCellIndex,e.sortDirection="A-Z"!=t.sortDirection?"A-Z":"Z-A",e.updateSortIcon(),e.filterAndSortData())}),r.on("mouseover",function(t,o){e.applyColumnHighlight(t)}),r.on("mouseout",function(t,o){e.clearColumnHighlight(t)}),r},e.updateSortIcon=function(){const t=e.titleCellList[e.sortByTitleIndex];t&&("A-Z"==e.sortDirection?(t.sortDirection="A-Z",t.icon.rotate=0):(t.sortDirection="Z-A",t.icon.rotate=180),t.icon.opacity=e.style.sortIcon.activeOpacity)};const x=function(t,o,l){t.color=o,e.itemLineList.forEach(function(e){e["itemCell"+t.titleCellIndex].color=l})};e.clearColumnHighlight=function(t){e.highlightTitle&&(x(t,"transparent","transparent"),e.itemLineList.forEach(I))},e.applyColumnHighlight=function(t){e.highlightTitle&&x(t,e.style.highlightTitleCellColor,e.style.highlightItemCellColor)},e.createItemLines=function(){y(null),e.itemLineList.forEach(function(t){t.remove()}),e.itemLineList=[];for(let t=0;t<e.itemLineCount;t++){const o=t,l=e.createItemLine(e.itemDataList[t],o);e.itemLineList.push(l),e.boxItemLineGroup.add(l)}},e.createItemLine=function(t,o){const l=HGroup({height:e.itemHeight||100,width:"auto",align:"top left",padding:[0,0],gap:0,color:o%2?e.style.line2Color:e.style.line1Color,position:"relative"});return e.titleDataList.forEach(function(t,o){l["itemCell"+o]=e.createItemCell(t.width,o,l)}),endGroup(),l.on("click",function(t){t.itemData&&(1==e.canSelect&&(e.selectItem(t.itemData),e.elem.focus({preventScroll:!0})),e.onSelect(e,t.itemData))}),"auto"!=e.style.height&&(l.visible=0),l};const I=function(t){const o=Boolean(t.itemData)&&t.itemData===e.selectedItemData;let l="transparent";t.isHover&&e.highlightLine&&(l=e.style.highlightItemCellColor),o&&(l=w()),function(t,o){for(let l=0;l<e.titleCellCount;l++)t["itemCell"+l].color=o}(t,l);const r=t.itemCell0;r&&(r.boxShadow=o?T():"none")},T=function(){if(!e.style.selectedBar.width)return"none";return"inset "+((basic.num(e.style.boxBorder.border)||0)+e.style.selectedBar.width)+"px 0 0 "+e.style.selectedBar.color},w=function(){return e.style.selectedItemCellColor||e.style.highlightItemCellColor},y=function(t){n=t,L()},L=function(){B(),n&&1==e.showCellTooltip&&(c=e.after(300,v))},v=function(){c=null;const t=D(n);"undefined"!=typeof Tooltip?t&&(a=Tooltip.show(n,t,e.style.cellTooltip,"top",function(e){k(t,e.look)}),a.cellText=t):n.elem.title=t},D=function(t){if(!t.itemLine.itemData)return"";const e=t.label.elem;return e.scrollWidth<=e.clientWidth?"":e.textContent},k=function(t,e){Label({plainText:t,fontSize:e.fontSize,textColor:e.textColor,css:{whiteSpace:"normal",overflowWrap:"anywhere",width:"max-content",maxWidth:e.maxWidth+"px"}})},B=function(){c&&c(),c=null,a&&a.remove(),a=null},F=function(){n&&(a&&a.cellText===n.label.elem.textContent||L())};e.setShowCellTooltip=function(t){e.showCellTooltip=basic.isOn(t)?1:0,L()},e.createItemCell=function(t,l,r){let i=AutoLayout({align:"center left",width:t||o,padding:e.style.boxItemCell.padding,height:"100%",color:"transparent",border:0});return that.css={borderBottom:e.style.boxItemCell.borderBottom,borderRight:e.style.boxItemCell.borderRight},i.label=Label({text:"",...e.style.lblItemCell}),that.css={whiteSpace:"nowrap",textOverflow:"ellipsis",fontFamily:e.style.lblItemCell.fontFamily},endAutoLayout(),i.on("mouseover",function(t,e){r.isHover=1,I(r)}),i.on("mouseout",function(t,e){r.isHover=0,I(r)}),i.itemLine=r,i.onHoverChange(function(t,e){!function(t,e){e?y(t):n===t&&y(null)}(i,e)}),e.createCellView&&createIn(i,function(){e.createCellView(i,l,e)}),i},e.initScrollMetrics=function(){e.scrollVars.minY=e.titleHeight,e.scrollVars.scrollAreaHeight=e.height-e.titleHeight-e.infoHeight,e.scrollVars.scrollIconHeight=e.btnScrollCenter.height,e.scrollVars.maxY=e.scrollVars.minY+e.scrollVars.scrollAreaHeight-e.scrollVars.scrollIconHeight,e.scrollVars.totalPath=e.scrollVars.maxY-e.scrollVars.minY,e.scrollVars.isDragging=!1,e.scrollVars.startY=0,e.scrollVars.startTop=0},e.syncScrollPosition=function(){const t=d();if(0===t)return;const o=e.startedItemIndexForScrolling/t;e.btnScrollCenter.top=e.scrollVars.minY+o*e.scrollVars.totalPath},e.createScrollEvents=function(){e.btnScrollCenter.clickable=1,e.btnScrollCenter.elem.setAttribute("draggable","false"),e.btnScrollCenter.cursor="grab",e.initScrollMetrics(),e.on("wheel",function(t,o){if(1!=e.wheelScroll)return;if(Math.abs(o.deltaX)>Math.abs(o.deltaY))return;o.preventDefault();const l=o.deltaY>0?1:-1,r=h(e.startedItemIndexForScrolling+l);r!==e.startedItemIndexForScrolling&&(e.startedItemIndexForScrolling=r,e.syncScrollPosition(),e.refreshData())},{passive:!1}),e.btnScrollCenter.on("mousedown",function(t,o){e.scrollVars.isDragging=!0,e.scrollVars.startY=o.clientY,e.scrollVars.startTop=e.btnScrollCenter.top,e.btnScrollCenter.cursor="grabbing",document.body.style.userSelect="none"}),e.listenTo(window,"mousemove",function(t,e){M(e)}),e.listenTo(window,"mouseup",function(){R()})};const M=function(t){if(!e||!e.scrollVars.isDragging)return;const o=t.clientY-e.scrollVars.startY;let l=e.scrollVars.startTop+o;if(l<e.scrollVars.minY&&(l=e.scrollVars.minY),l>e.scrollVars.maxY&&(l=e.scrollVars.maxY),e.btnScrollCenter.top=l,e.scrollVars.totalPath<=0)return;const r=(l-e.scrollVars.minY)/e.scrollVars.totalPath,i=Math.round(r*d());i!==e.startedItemIndexForScrolling&&(e.startedItemIndexForScrolling=i,e.refreshData())},R=function(){e&&e.scrollVars.isDragging&&(e.scrollVars.isDragging=!1,e.btnScrollCenter.cursor="grab",document.body.style.userSelect="auto")};e.getSelectedIndex=function(){return e.selectedItemData?e.visibleItemDataList.indexOf(e.selectedItemData):-1},e.selectItem=function(t){1==e.canSelect&&(e.selectedItemData=t||null,H(),e.refreshData())},e.clearSelection=function(){e.selectItem(null)},e.setCanSelect=function(t){e.canSelect=basic.isOn(t)?1:0,1!=e.canSelect&&(e.selectedItemData=null),A(),e.refreshData()};const A=function(){e.tabIndex=1==e.canSelect?0:null,1!=e.canSelect&&e.elem.blur()},V=function(){const t=e.elem.matches(":focus-visible");e.boxBorder.css.outline=t?"2px solid "+e.style.focusRingColor:"none",e.boxBorder.css.outlineOffset="-2px"},H=function(){const t=e.getSelectedIndex();if(-1==t)return;let o=e.startedItemIndexForScrolling;t<o&&(o=t),t>=o+e.itemLineCount&&(o=t-e.itemLineCount+1),e.startedItemIndexForScrolling=h(o),e.syncScrollPosition()};e.scrollPage=function(t){const o=h(e.startedItemIndexForScrolling+t*e.itemLineCount);o!==e.startedItemIndexForScrolling&&(e.startedItemIndexForScrolling=o,e.refreshData(),e.syncScrollPosition())},e.updateInfoLabel=function(){const t=e.visibleItemDataList.length;if(0==t)return e.boxInfoLine.label.text="0 - 0 / 0",void(e.lblNoDataFound.opacity=1);e.lblNoDataFound.opacity=0;const o=e.startedItemIndexForScrolling+1;let l=e.startedItemIndexForScrolling+e.itemLineCount;l>t&&(l=t),e.boxInfoLine.label.text=`${z(o)} - ${z(l)} / ${z(t)}`};const z=function(t){try{return t.toLocaleString(e.locale||document.documentElement.lang||l)}catch(e){return t.toLocaleString(l)}};e.setLocale=function(t){e.locale=t,e.updateInfoLabel(),e.refreshData()},e.setScrollToTop=function(){e.startedItemIndexForScrolling=0,e.btnScrollCenter.top=e.scrollVars.minY},e.setItemDataList=function(t){e.itemDataList=[...t],e.filterAndSortData()};const N=function(t,o){if(""===o)return t;const l=e.titleDataList[e.searchTitleIndex],r=l?[l]:e.titleDataList;return t.filter(t=>r.some(e=>function(t,e){return null!=t&&SmartTable.toSearchText(t).includes(e)}(t[e.dataTitle],o)))},E=function(t,o,l){const r=e.titleDataList[o];if(!r||0===r.sortable)return;const i=r.dataTitle;t.sort((t,e)=>{const o=function(t,e){const o=u(t),l=u(e);return Number.isFinite(o)&&Number.isFinite(l)?o-l:String(t).localeCompare(String(e),"tr")}(t[i]??"",e[i]??"");return"A-Z"===l?o:-o})};e.filterAndSortData=function(){e.itemDataList.length>1e3&&e.showLoading(1),e.filterTimer=waitAndRun(e.filterTimer,function(){e.filterTimer=null;const t=SmartTable.toSearchText(e.searchKeyword??"").trim(),o=N([...e.itemDataList],t);E(o,e.sortByTitleIndex,e.sortDirection),e.visibleItemDataList=o,e.setScrollToTop(),-1==e.getSelectedIndex()&&(e.selectedItemData=null),H(),e.refreshData(),e.showLoading(0)},50)},e.generateTestData=function(){let t=[];for(let o=0;o<1e5;o++){const o=e.itemDataList.map(e=>({...e,id:t.length+e.id}));t.push(...o)}e.itemDataList=t,e.visibleItemDataList=t,console.log("Yeni veri sayısı:",e.visibleItemDataList.length)},e.createVerticalScroll=function(){const t=e.style.verticalScrollWidth,o=-1*(t+e.style.verticalScrollMargin);e.btnScrollCenter=startBox(0,0,t,50,{right:o,top:e.titleHeight,opacity:0,clickable:0,...e.style.btnScrollCenter}),Icon(0,0,"100%","100%"),that.load(e.style.btnScrollCenterIconFile),endBox(),e.btnScrollUp=Box(0,0,t,e.titleHeight,{right:o,...e.style.btnScrollUp}),that.cursor="pointer",that.on("click",function(t,o){e.scrollPage(-1)}),Icon(0,0,"100%","100%"),e.btnScrollUp.add(that),that.load(e.style.btnScrollUpIconFile),1==e.style.invertIconColor&&(that.css.filter="invert(100%)"),e.btnScrollDown=Box(0,0,t,e.infoHeight,{right:o,bottom:0,...e.style.btnScrollDown}),that.cursor="pointer",that.on("click",function(t,o){e.scrollPage(1)}),Icon(0,0,"100%","100%"),e.btnScrollDown.add(that),that.load(e.style.btnScrollDownIconFile),1==e.style.invertIconColor&&(that.css.filter="invert(100%)")};const W=function(){const t=e.lblSelectedSortKey.elem.offsetWidth,o=t>0;e.searchInput.setClearIconRight(o?6+t+6:i)};e.createToolbar=function(){HGroup({align:"left center",gap:12,padding:[8,0]}),e.boxInfoLine.add(that),e.searchInput=SearchInput(e.searchInputParams),that.setValue(e.searchKeyword,1),that.onEnter=function(t){e.searchKeyword=t.getSearchText(),e.filterAndSortData()},i=that.clearIconRight,function(){const t=String(e.searchInputParams.width);e.searchInput.css.minWidth="0px",t.endsWith("%")&&(e.searchInput.css.flexGrow="1",e.searchInput.css.maxWidth="max("+t+", 240px)")}(),e.boxInfoLine.label=Label({text:"0 - 0 / 0",...e.style.lblBoxInfoLine}),that.css={marginLeft:"auto",marginRight:"6px",flexShrink:"0"},endGroup(),e.lblSelectedSortKey=createIn(e.searchInput,function(){return Label({right:6,opacity:1,clickable:1,...e.style.lblNoDataFound,...e.style.lblSearchTitle})}),s(e.lblSelectedSortKey,e.allTitlesText),that.cursor="pointer",that.ellipsis=1,that.css.maxWidth="160px",that.css.top="50%",that.css.transform="translateY(-50%)",that.setMotion("opacity 0.2s"),that.onResize(W),"function"==typeof ContextMenu?(e.searchTitleMenu=ContextMenu({minWidth:160,...e.searchTitleMenuParams,onClick:function(t,o){e.setSearchTitleIndex(o.data)}}),e.searchTitleMenu.attachTo(e.lblSelectedSortKey,"click")):e.lblSelectedSortKey.on("click",function(){e.selectNextSearchTitle()})},e.stretchLastCell=function(t){if(!(t>0)||0==e.titleCellCount)return;const o=e.titleCellCount-1;e.itemLineList.forEach(function(e){e["itemCell"+o].width=t}),e.titleCellList[o].width=t},e.calcLastCellWidth=function(){const t=e.titleDataList,l=e.width;if(0==t.length)return 0;let r=0;t.forEach(function(t){r+=basic.num(t.width||o)});const i=basic.num(t[t.length-1].width||o);return l>r?l-r+i:i},e.setItemHeight=function(t){e.itemHeight=t,e.itemLineList.forEach(function(t){t.height=e.itemHeight,t.visible=1})},e.setHeight=function(t){e.recalcItemHeight="auto"!=t?1:0,e.height=t},e.setWidth=function(t){if(!("string"==typeof t&&t.includes("%")))return e.width=t,void(e.css={marginRight:e.getVerticalScrollWidth()+"px"});e.css.marginRight&&(e.css={marginRight:""}),e.width="calc("+t+" - "+e.getVerticalScrollWidth()+"px)"},e.getTotalWidth=function(){return e.width+e.getVerticalScrollWidth()},e.getVerticalScrollWidth=function(){return e.style.verticalScrollWidth+e.style.verticalScrollMargin},e.createLoading=function(){e.boxLoading=VGroup({color:Black(.3),clickable:1,round:e.style.round}),e.add(e.boxLoading),Icon({width:32,height:32}),that.load(e.style.loadingIconFile),endGroup()},e.showLoading=function(t){t?(e.boxLoading.visible=1,e.setVerticalScrollEnabled(!1)):(e.boxLoading.visible=0,e.setVerticalScrollEnabled(!0))},e.createNoDataFoundLabel=function(){HGroup(),e.lblNoDataFound=Label({opacity:0,...e.style.lblNoDataFound}),s(e.lblNoDataFound,e.noDataFoundAlert),that.setMotion("opacity 0.2s"),endGroup()};const O=function(t){return String(t.name??"").replace(/<[^>]*>/g,"").trim()||String(t.dataTitle??"")};e.updateSearchTitleSelect=function(){e.titleDataList[e.searchTitleIndex]||(e.searchTitleIndex=-1);const t=e.titleDataList[e.searchTitleIndex];if(s(e.lblSelectedSortKey,t?O(t):e.allTitlesText),e.lblSelectedSortKey.visible=1==e.showSearchTitleSelect?1:0,!e.searchTitleMenu)return;const o=function(t){return e.searchTitleIndex==t?e.style.searchTitleCheckIconFile:""},l=[{text:e.allTitlesText,data:-1,iconFile:o(-1)},"-"];e.titleDataList.forEach(function(t,e){l.push({text:O(t),data:e,iconFile:o(e)})}),e.searchTitleMenu.setItems(l),1!=e.showSearchTitleSelect&&e.searchTitleMenu.close()},e.setSearchTitleIndex=function(t){e.searchTitleIndex=e.titleDataList[t]?t:-1,e.updateSearchTitleSelect(),""!==String(e.searchKeyword??"").trim()&&e.filterAndSortData()},e.selectNextSearchTitle=function(){const t=e.searchTitleIndex+1;e.setSearchTitleIndex(t<e.titleDataList.length?t:-1)},e.setShowSearchTitleSelect=function(t){e.showSearchTitleSelect=basic.isOn(t)?1:0,e.updateSearchTitleSelect()},e.setWheelScroll=function(t){e.wheelScroll=basic.isOn(t)?1:0};const P=function(){return e.height-e.titleHeight-e.infoHeight},U=function(){if(e.recalcItemHeight&&1==e.fitLineCount)_();else if(e.recalcItemHeight){const t=P()/e.itemLineCount;(e.itemHeight!=t||e.itemLineList[0]&&!e.itemLineList[0].visible)&&e.setItemHeight(t)}e.stretchLastCell(e.calcLastCellWidth()),e.initScrollMetrics(),e.syncScrollPosition(),e.scrollBar.refreshScroll(),e.refreshData()},_=function(){const t=P();if(t<=0)return;const o=Math.max(1,Math.round(t/r));o==e.itemLineList.length?e.setItemHeight(t/o):e.setItemLineCount(o)};return e.setItemLineCount=function(t){e.itemLineCount=Math.max(1,Math.round(t)),e.createItemLines();const o=P(),l=e.recalcItemHeight&&o>0;e.setItemHeight(l?o/e.itemLineCount:e.itemHeight),e.stretchLastCell(e.calcLastCellWidth()),e.startedItemIndexForScrolling=h(e.startedItemIndexForScrolling),H(),e.initScrollMetrics(),e.syncScrollPosition(),e.refreshData()},e.setFitLineCount=function(t){e.fitLineCount=basic.isOn(t)?1:0,U()},e.createResizeEvent=function(){e.onResize(function(t){e.resizeTimer=waitAndRun(e.resizeTimer,U,3)})},e.init=function(){e.clickable=1,e.clipContent=0,e.color=e.style.box.color,e.round=e.style.round,1==e.invertColor&&(e.css.filter="invert(100%)"),e.setWidth(e.style.width),e.setHeight(e.style.height),e.boxHorizontalScrollable=VGroup({align:"top left",width:"auto",height:"auto",padding:[0,0],gap:0,position:"relative",clipContent:0,scrollX:1}),that.css={borderTopLeftRadius:e.style.round+"px",borderTopRightRadius:e.style.round+"px",borderBottomRightRadius:"0px",borderBottomLeftRadius:"0px",marginBottom:e.infoHeight+"px"},e.boxTitleLine=HGroup({height:"auto",width:"auto",align:"top left",padding:[0,0],gap:0,color:e.style.boxTitleLine.color}),endGroup(),e.boxItemLineGroup=VGroup({align:"top left",width:"auto",height:"auto",padding:[0,0],gap:0}),endGroup(),endGroup(),e.boxInfoLine=HGroup({bottom:0,left:0,height:e.infoHeight,width:"100%",align:"top left",padding:[0,0],gap:0,...e.style.boxInfoLine}),endGroup(),that.css={borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomRightRadius:e.style.round+"px",borderBottomLeftRadius:e.style.round+"px",borderTop:e.style.boxInfoLine.borderTop},that.clickable=0,e.createToolbar(),e.createNoDataFoundLabel(),e.boxBorder=Box(0,0,"100%","100%",e.style.boxBorder),that.round=e.style.round,that.color="transparent",e.createVerticalScroll(),e.scrollBar=ScrollBar({scrollableBox:e.boxHorizontalScrollable,...e.scrollBarParams}),e.createResizeEvent(),e.createLoading()},e.init(),e.createTitleLine(),e.createItemLines(),e.createScrollEvents(),e.on("keydown",function(t,o){if(1!=e.canSelect||o.target!=e.elem)return;if(o.metaKey||o.ctrlKey||o.altKey)return;if("Enter"==o.key)return void(e.selectedItemData&&e.onSelect(e,e.selectedItemData));const l=function(t){const o=e.itemLineCount,l=e.visibleItemDataList.length;return{ArrowDown:1,ArrowUp:-1,PageDown:o,PageUp:-o,Home:-l,End:l}[t]||0}(o.key);0!=l&&(o.preventDefault(),function(t){const o=e.visibleItemDataList.length;if(0==o)return;let l=e.getSelectedIndex();-1==l&&(l=t>0?-1:o),e.selectItem(e.visibleItemDataList[basic.clamp(l+t,0,o-1)])}(l),V())}),e.on("focus",V),e.on("blur",V),A(),e.stretchLastCell(e.calcLastCellWidth()),e.updateSortIcon(),e.updateSearchTitleSelect(),e.fillTestData&&e.generateTestData(),e.filterAndSortData(),endObject(e)};SmartTable.toSearchText=function(t){const e=String(t).toLocaleLowerCase("tr");return SmartTable.NOT_ASCII.test(e)?e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/ı/g,"i"):e},SmartTable.NOT_ASCII=/[^\u0000-\u007f]/,SmartTable.styles={light:{style:{}},dark:{style:{line1Color:"#232428",line2Color:"#27292D",highlightItemCellColor:"#2E3035",selectedItemCellColor:"#24383A",focusRingColor:"rgba(95, 179, 181, 0.7)",highlightTitleCellColor:"#33353A",btnScrollCenterIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 50" fill="none" stroke="#FFFFFF" stroke-opacity="0.5" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M10 17.5v15M6.5 21 10 17.5 13.5 21M6.5 29 10 32.5 13.5 29"/></svg>'),searchTitleCheckIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#E6E6E6" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5 10 17.5 19 7"/></svg>'),invertIconColor:1,sortIcon:{size:16,opacity:.3,activeOpacity:1},cellTooltip:{color:"#2B2D31",textColor:"rgba(255, 255, 255, 0.88)",borderColor:"rgba(255, 255, 255, 0.14)",shadow:"0 8px 24px rgba(0, 0, 0, 0.5)"},box:{color:"#232428"},boxBorder:{border:1,borderColor:"rgba(255, 255, 255, 0.12)"},boxTitleLine:{color:"#2B2D31"},boxTitleCell:{borderRight:"1px solid rgba(255, 255, 255, 0.08)",borderBottom:"1px solid rgba(255, 255, 255, 0.14)"},lblTitleCell:{textColor:"rgba(255, 255, 255, 0.85)"},boxItemCell:{borderBottom:"1px solid rgba(255, 255, 255, 0.06)"},lblItemCell:{textColor:"rgba(255, 255, 255, 0.75)"},boxInfoLine:{color:"#232428",borderTop:"1px solid rgba(255, 255, 255, 0.14)"},lblBoxInfoLine:{textColor:"rgba(255, 255, 255, 0.5)"},lblNoDataFound:{textColor:"rgba(255, 255, 255, 0.45)"},lblSearchTitle:{color:"#33353A",textColor:"rgba(255, 255, 255, 0.7)",borderColor:"rgba(255, 255, 255, 0.14)"},btnScrollCenter:{color:"#2B2D31",borderColor:"rgba(255, 255, 255, 0.2)"},btnScrollUp:{color:"#2B2D31",borderColor:"rgba(255, 255, 255, 0.14)"},btnScrollDown:{color:"#2B2D31",borderColor:"rgba(255, 255, 255, 0.14)"}},searchInputParams:{styleName:"ozdenDark"},scrollBarParams:{bar_color:"#A0A0A0",bar_mouseOverColor:"#D0D0D0"},searchTitleMenuParams:{styleName:"dark"}},green:{style:{width:"auto",height:"auto",round:6,line1Color:"white",line2Color:"whitesmoke",highlightItemCellColor:"#F3E7C2",selectedItemCellColor:null,selectedBar:{width:3,color:"rgba(95, 158, 160, 0.9)"},focusRingColor:"rgba(95, 158, 160, 0.6)",highlightTitleCellColor:White(.2),titleUppercase:0,verticalScrollWidth:20,verticalScrollMargin:2,btnScrollDownIconFile:SmartTableDefaults.style.btnScrollDownIconFile,btnScrollUpIconFile:SmartTableDefaults.style.btnScrollUpIconFile,btnScrollCenterIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 200" preserveAspectRatio="none" fill="none" stroke="#D96450" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 28V172M27 41L40 28L53 41M27 159L40 172L53 159"/></svg>'),sortIconFile:"data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" preserveAspectRatio="none" fill="none" stroke="#141414" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M40 24V56M27 43L40 56L53 43"/></svg>'),loadingIconFile:SmartTableDefaults.style.loadingIconFile,searchTitleCheckIconFile:"data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#373836" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5 10 17.5 19 7"/></svg>'),invertIconColor:0,sortIcon:{size:22,opacity:.5,activeOpacity:1},box:{color:"white"},boxBorder:{border:2,borderColor:Black(.8)},boxTitleLine:{color:"#65A293"},boxTitleCell:{padding:[8,0],borderRight:"1px solid rgba(0, 0, 0, 0.5)",borderBottom:"2px solid #141414"},lblTitleCell:{fontSize:20,fontFamily:"opensans",textColor:Black(.8)},boxItemCell:{borderBottom:"1px solid darkgray",borderRight:"1px solid rgba(0, 0, 0, 0.05)",padding:[8,0]},lblItemCell:{fontSize:20,textColor:Black(.75),fontFamily:"opensans"},boxInfoLine:{color:"#E4E4E4",borderTop:"1px solid rgba(0, 0, 0, 0)"},lblBoxInfoLine:{fontSize:16,textColor:Black(.85)},lblNoDataFound:{color:"lightgray",textColor:Black(.8),padding:[8,2],fontSize:14,round:8,border:1,borderColor:Black(.4)},lblSearchTitle:{color:"whitesmoke",textColor:Black(.8),padding:[8,2],fontSize:14,round:8,border:1,borderColor:Black(.15)},btnScrollCenter:{color:"white",round:100,border:1,borderColor:"rgba(0,0,0,0.4)"},btnScrollUp:{color:"lightgray",round:100,border:1,borderColor:"rgba(0, 0, 0, 0.6)"},btnScrollDown:{color:"lightgray",round:100,border:1,borderColor:"rgba(0, 0, 0, 0.6)"},boxSort:{color:"#65A293"}},searchInputParams:{styleName:"original",width:"50%",height:36,border:1,round:8,color:"white",searchIconSize:16,placeholder:"Filter",fontSize:16,borderColor:Black(.15),borderBottomStyle:"1px solid "+Black(.15),searchIconFile:SmartTableDefaults.searchInputParams.searchIconFile,searchIconOpacity:.8}}},SmartTable.styles.classic=SmartTable.styles.light,SmartTable.createMinimalStyle=function(t){return{titleHeight:30,itemHeight:28,infoHeight:28,style:Object.assign({round:4,line1Color:t.ground,line2Color:t.ground,highlightItemCellColor:t.hover,selectedItemCellColor:t.selected,selectedBar:{width:2,color:t.ink},focusRingColor:t.focus,highlightTitleCellColor:t.ground,titleUppercase:0,invertIconColor:t.invertIcons,sortIcon:{size:14,opacity:.3,activeOpacity:1},cellTooltip:{fontSize:12,color:t.ground,textColor:t.text,round:4,border:1,borderColor:t.line,shadow:"none"},box:{color:t.ground},boxBorder:{border:1,borderColor:t.line},boxTitleLine:{color:t.ground},boxTitleCell:{padding:[10,0],borderRight:"none",borderBottom:"1px solid "+t.line},lblTitleCell:{fontSize:12,fontFamily:"opensans-bold",textColor:t.softText},boxItemCell:{borderBottom:"1px solid "+t.track,borderRight:"none",padding:[10,0]},lblItemCell:{fontSize:13,textColor:t.text,fontFamily:"opensans"},boxInfoLine:{color:t.ground,borderTop:"1px solid "+t.line},lblBoxInfoLine:{fontSize:12,textColor:t.softText},lblNoDataFound:{color:"transparent",textColor:t.softText,fontSize:12},lblSearchTitle:{color:"transparent",textColor:t.softText,fontSize:11,border:0,borderColor:"transparent"},btnScrollCenter:{color:t.ground,borderColor:t.line},btnScrollUp:{color:t.ground,borderColor:t.line},btnScrollDown:{color:t.ground,borderColor:t.line}},t.icons),searchInputParams:{styleName:t.minimalName,height:22,fontSize:12,searchIconSize:12,searchIconLeft:8},scrollBarParams:{bar_color:t.scrollBar,bar_mouseOverColor:t.scrollBar,bar_width:3},searchTitleMenuParams:{styleName:t.minimalName}}},SmartTable.MINIMAL_COLORS={ground:"#FFFFFF",text:Black(.85),softText:Black(.55),line:Black(.2),track:Black(.08),hover:Black(.03),selected:Black(.06),ink:"#1F1F1F",focus:"#3D8BD9",scrollBar:"#9A9A98",invertIcons:0,minimalName:"minimal",icons:{}},SmartTable.styles.minimal=SmartTable.createMinimalStyle(SmartTable.MINIMAL_COLORS),SmartTable.MINIMAL_DARK_COLORS={ground:"#1A1A19",text:White(.88),softText:White(.55),line:White(.18),track:White(.08),hover:White(.04),selected:White(.08),ink:"#EDEDEB",focus:"#7FB6DE",scrollBar:"#A0A0A0",invertIcons:1,minimalName:"minimalDark",icons:{btnScrollCenterIconFile:SmartTable.styles.dark.style.btnScrollCenterIconFile,searchTitleCheckIconFile:SmartTable.styles.dark.style.searchTitleCheckIconFile}},SmartTable.styles.minimalDark=SmartTable.createMinimalStyle(SmartTable.MINIMAL_DARK_COLORS);
|