@ninebone/datagrid 0.0.11 → 0.0.13

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.
@@ -506,25 +506,17 @@ cell-row-indicator {
506
506
  pointer-events: none;
507
507
  }
508
508
 
509
- .ng-row-status {
509
+ .row-status {
510
+ display: inline-block;
510
511
  position: absolute;
511
- right: 2px;
512
+ right: 0;
512
513
  top: 1px;
513
- font-size: var(--row-indicator-status-size);
514
- line-height: 1;
515
- pointer-events: none;
514
+ width: 4px;
515
+ height: 4px;
516
+ border-radius: 50%;
516
517
  }
517
518
  }
518
519
 
519
- cell-row-indicator .row-status {
520
- display: inline-block;
521
- position: absolute;
522
- right: 0;
523
- top: 1px;
524
- width: 4px;
525
- height: 4px;
526
- border-radius: 50%;
527
- }
528
520
 
529
521
  cell-row-indicator.is-insert .row-status {
530
522
  background-color: #333;
@@ -543,6 +535,17 @@ cell-row-indicator.is-delete .row-status {
543
535
  }
544
536
 
545
537
  tbody {
538
+
539
+ tr.selected {
540
+ cell-row-indicator {
541
+ border-left: 2px solid darkgoldenrod;
542
+ }
543
+
544
+ cell-row-indicator {
545
+ border-left: 2px solid darkgoldenrod;
546
+ }
547
+ }
548
+
546
549
  .selected {
547
550
  background-color: var(--cell-selection-bg);
548
551
  }
@@ -1519,31 +1522,54 @@ nine-table-sheets-footer {
1519
1522
  }
1520
1523
 
1521
1524
 
1525
+
1522
1526
  .asc::after,
1523
1527
  .desc::after {
1524
- --sort-icon-size: 10px;
1525
-
1528
+ z-index: 1;
1526
1529
  content: "";
1527
1530
  display: inline-block;
1528
- width: var(--sort-icon-size);
1529
- height: var(--sort-icon-size);
1530
- flex-shrink: 0;
1531
- margin-left: 4px;
1532
- vertical-align: middle;
1531
+ width: 10px;
1532
+ height: 10px;
1533
+ position: absolute;
1534
+ left: 50%;
1535
+ top: -2px;
1536
+ transform: translateX(-50%);
1533
1537
  background-repeat: no-repeat;
1534
1538
  background-position: center;
1535
1539
  background-size: contain;
1536
1540
  }
1537
1541
 
1538
1542
  .asc::after {
1539
- --sort-icon-color: #2563eb;
1540
1543
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 16 16"><path fill="%232563eb" d="M8 3L3 11h10L8 3z"/></svg>');
1541
1544
  }
1542
1545
 
1543
1546
  .desc::after {
1544
- --sort-icon-color: #dc2626;
1545
1547
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 16 16"><path fill="%23dc2626" d="M8 13L3 5h10l-5 8z"/></svg>');
1546
1548
  }
1549
+
1550
+
1551
+ tbody.body td *:first-child, tbody.body th *:first-child {
1552
+ transform: translate(0, 0);
1553
+ transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1.35), opacity 0.4s ease-out;
1554
+ }
1555
+
1556
+ tbody.body .sorting-anim-asc *:first-child {
1557
+ transform: translate(0px, 20px);
1558
+ opacity: 0.2;
1559
+ transition: none;
1560
+ }
1561
+
1562
+ tbody.body .sorting-anim-desc *:first-child {
1563
+ transform: translate(0px, -30px);
1564
+ opacity: 0.2;
1565
+ transition: none;
1566
+ }
1567
+
1568
+ tbody.body .sorting-anim-none *:first-child {
1569
+ transform: translate(0px, 0px);
1570
+ opacity: 0.2;
1571
+ transition: none;
1572
+ }
1547
1573
  table {
1548
1574
  --table-th-bg: #f9fafb;
1549
1575
  --table-th-color: #111827;
@@ -271,8 +271,8 @@ var n = new class extends e.constructor {
271
271
  e = parseInt(e, 10);
272
272
  let i = this.getHostFields().indexOf(t);
273
273
  if (i < 0) return;
274
- let a = this.#i()[e];
275
- a && (a.v[i] !== n && a.m._[r.META.INDEX.ROW_STATE] !== r.ROW_STATE.INSERT && (a.m._[r.META.INDEX.ROW_STATE] = r.ROW_STATE.UPDATE), a.v[i] = n);
274
+ let a = this.#u(e), o = this.#t.rawRecords[a];
275
+ o && (o.v[i] !== n && o.m._[r.META.INDEX.ROW_STATE] !== r.ROW_STATE.INSERT && (o.m._[r.META.INDEX.ROW_STATE] = r.ROW_STATE.UPDATE), o.v[i] = n);
276
276
  };
277
277
  #d = (e) => {
278
278
  if (!e) return e;
@@ -2229,10 +2229,19 @@ var k = class {
2229
2229
  }) : c ? u >= 0 ? this.#n[u].asc = !1 : this.#n.push({
2230
2230
  ...d,
2231
2231
  asc: !1
2232
- }) : this.#n = this.#n.filter((e) => !(e.colIndex === n && e.subRowIndex === i || e.colName === o)), this.#a();
2232
+ }) : this.#n = this.#n.filter((e) => !(e.colIndex === n && e.subRowIndex === i || e.colName === o)), this.#a(t);
2233
2233
  }
2234
- #a() {
2235
- this.#e.view && (this.#e.view.setSorting(this.#n), this.#o(), this.#e.invalidate());
2234
+ #a(e) {
2235
+ this.#e.view.setSorting(this.#n), this.#o(), this.#e.invalidate(), requestAnimationFrame(() => {
2236
+ let t = this.#e.querySelectorAll("tbody.body th, tbody.body td");
2237
+ t.forEach((t) => {
2238
+ t.classList.remove("sorting-anim-asc", "sorting-anim-desc", "sorting-anim-none"), e.classList.contains("asc") ? t.classList.add("sorting-anim-asc") : e.classList.contains("desc") ? t.classList.add("sorting-anim-desc") : t.classList.add("sorting-anim-none");
2239
+ }), requestAnimationFrame(() => {
2240
+ t.forEach((e) => {
2241
+ e.classList.remove("sorting-anim-asc", "sorting-anim-desc", "sorting-anim-none");
2242
+ });
2243
+ });
2244
+ });
2236
2245
  }
2237
2246
  #o() {
2238
2247
  this.#e.querySelectorAll("thead th, thead td").forEach((e) => {
@@ -2843,7 +2852,7 @@ var N = class {
2843
2852
  let e = Array.from(this.#e.children).filter((e) => e.tagName.toUpperCase() === "TABLE"), t = this.#e.getAttribute("auto-height") === "true", n = e.length, r = e.map((e, t) => {
2844
2853
  let r = t === 0 ? "active" : "", i = e.id || `sheet${t + 1}`;
2845
2854
  return `<nine-table-sheet class="${r}" data-index="${t}" data-sheet-id="${i}" id="${i}"></nine-table-sheet>` + (t < n - 1 ? `<nine-splitter class="h" data-split-index="${t}"></nine-splitter>` : "");
2846
- }).join(""), i = ["@import \"https://cdn.jsdelivr.net/npm/@ninebone/datagrid@0.0.11/dist/css/nine-table.css\";"];
2855
+ }).join(""), i = ["@import \"https://cdn.jsdelivr.net/npm/@ninebone/datagrid@0.0.13/dist/css/nine-table.css\";"];
2847
2856
  nine["nine-table"] && nine["nine-table"].cssFile && i.push(`@import "${nine["nine-table"].cssFile}";`), this.#e.shadowRoot.innerHTML = `
2848
2857
  <style>
2849
2858
  ${i.join("\n")}
@@ -2912,7 +2921,7 @@ var N = class {
2912
2921
  #r = 0;
2913
2922
  #i = "";
2914
2923
  constructor() {
2915
- super(), ["NINE-TABLE"].includes(this.tagName) && n.log("Welcome nine-table", "0.0.11"), this.#e = this.attachShadow({ mode: "open" }), this.#t = new o(this);
2924
+ super(), ["NINE-TABLE"].includes(this.tagName) && n.log("Welcome nine-table", "0.0.13"), this.#e = this.attachShadow({ mode: "open" }), this.#t = new o(this);
2916
2925
  }
2917
2926
  connectedCallback() {
2918
2927
  setTimeout(() => {