@polygrid/core 1.0.3-a → 1.0.3-b

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.
@@ -21,5 +21,6 @@ export declare const PG_CSS_CLASS: {
21
21
  readonly footerViewport: "pg-footer-viewport";
22
22
  readonly footer: "pg-footer";
23
23
  readonly footerCell: "pg-footer-cell";
24
+ readonly noData: "pg-no-data";
24
25
  };
25
26
  //# sourceMappingURL=pg-css-class.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pg-css-class.d.ts","sourceRoot":"","sources":["../../../src/engine/const/pg-css-class.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;CAuBf,CAAC"}
1
+ {"version":3,"file":"pg-css-class.d.ts","sourceRoot":"","sources":["../../../src/engine/const/pg-css-class.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;CAwBf,CAAC"}
@@ -21,5 +21,6 @@ export const PG_CSS_CLASS = {
21
21
  footerViewport: "pg-footer-viewport",
22
22
  footer: "pg-footer",
23
23
  footerCell: "pg-footer-cell",
24
+ noData: "pg-no-data",
24
25
  };
25
26
  //# sourceMappingURL=pg-css-class.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pg-css-class.js","sourceRoot":"","sources":["../../../src/engine/const/pg-css-class.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,aAAa;IACvB,OAAO,EAAE,aAAa;IACtB,gBAAgB,EAAE,wBAAwB;IAC1C,YAAY,EAAE,mBAAmB;IACjC,YAAY,EAAE,mBAAmB;IACjC,mBAAmB,EAAE,2BAA2B;IAChD,mBAAmB,EAAE,2BAA2B;IAChD,OAAO,EAAE,aAAa;IACtB,YAAY,EAAE,mBAAmB;IACjC,YAAY,EAAE,mBAAmB;IACjC,cAAc,EAAE,oBAAoB;IACpC,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,gBAAgB;IAC5B,YAAY,EAAE,kBAAkB;IAChC,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,SAAS;IACf,cAAc,EAAE,oBAAoB;IACpC,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,gBAAgB;CACpB,CAAC"}
1
+ {"version":3,"file":"pg-css-class.js","sourceRoot":"","sources":["../../../src/engine/const/pg-css-class.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,aAAa;IACvB,OAAO,EAAE,aAAa;IACtB,gBAAgB,EAAE,wBAAwB;IAC1C,YAAY,EAAE,mBAAmB;IACjC,YAAY,EAAE,mBAAmB;IACjC,mBAAmB,EAAE,2BAA2B;IAChD,mBAAmB,EAAE,2BAA2B;IAChD,OAAO,EAAE,aAAa;IACtB,YAAY,EAAE,mBAAmB;IACjC,YAAY,EAAE,mBAAmB;IACjC,cAAc,EAAE,oBAAoB;IACpC,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,gBAAgB;IAC5B,YAAY,EAAE,kBAAkB;IAChC,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,SAAS;IACf,cAAc,EAAE,oBAAoB;IACpC,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,YAAY;CACZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/services/renderer/parts/body/body.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,wBAAgB,UAAU,CACxB,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,OAAO,GACf,cAAc,CAyBhB"}
1
+ {"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/services/renderer/parts/body/body.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D,wBAAgB,UAAU,CACxB,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,OAAO,GACf,cAAc,CAgChB"}
@@ -1,4 +1,5 @@
1
1
  import { PG_CSS_CLASS } from "../../../../const/pg-css-class";
2
+ import { renderNoData } from "../no-data/no-data";
2
3
  import { renderRows } from "./row";
3
4
  export function renderBody(store, gridDom) {
4
5
  // viewport
@@ -8,17 +9,24 @@ export function renderBody(store, gridDom) {
8
9
  const bodyEl = document.createElement("div");
9
10
  bodyEl.className = PG_CSS_CLASS.body;
10
11
  bodyEl.innerHTML = "";
11
- // render the rows
12
+ // if we have rows
12
13
  const rows = store.getState().rows;
13
- const columns = store.getState().columns;
14
- const rowHeight = store.getState().rowHeight;
15
- const bodyRows = renderRows(rows, columns, rowHeight);
16
- // append the rows to the body
17
- const fragment = document.createDocumentFragment();
18
- for (const row of bodyRows) {
19
- fragment.appendChild(row);
14
+ if (rows.length > 0) {
15
+ // render the rows
16
+ const columns = store.getState().columns;
17
+ const rowHeight = store.getState().rowHeight;
18
+ const bodyRows = renderRows(rows, columns, rowHeight);
19
+ // append the rows to the body
20
+ const fragment = document.createDocumentFragment();
21
+ for (const row of bodyRows) {
22
+ fragment.appendChild(row);
23
+ }
24
+ bodyEl.appendChild(fragment);
25
+ }
26
+ else {
27
+ // render no data template
28
+ renderNoData(bodyEl);
20
29
  }
21
- bodyEl.appendChild(fragment);
22
30
  bodyViewportEl.appendChild(bodyEl);
23
31
  gridDom.body = bodyEl;
24
32
  return bodyViewportEl;
@@ -1 +1 @@
1
- {"version":3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AAM,CAAC,CAAC;IACvB,CAAC;IAED,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAEnC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;IAEtB,OAAO,cAAc,CAAC;AACxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function renderNoData(body: HTMLDivElement): void;
2
+ //# sourceMappingURL=no-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-data.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/services/renderer/parts/no-data/no-data.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,QAoBhD"}
@@ -0,0 +1,18 @@
1
+ import { PG_CSS_CLASS } from "../../../../const/pg-css-class";
2
+ export function renderNoData(body) {
3
+ const noData = document.createElement("div");
4
+ noData.className = PG_CSS_CLASS.noData;
5
+ const icon = document.createElement("div");
6
+ icon.className = `${PG_CSS_CLASS.noData}__icon`;
7
+ const title = document.createElement("div");
8
+ title.className = `${PG_CSS_CLASS.noData}__title`;
9
+ title.textContent = "No data available";
10
+ const subtitle = document.createElement("div");
11
+ subtitle.className = `${PG_CSS_CLASS.noData}__subtitle`;
12
+ subtitle.textContent = "Try adjusting your filters or loading data.";
13
+ noData.appendChild(icon);
14
+ noData.appendChild(title);
15
+ noData.appendChild(subtitle);
16
+ body.appendChild(noData);
17
+ }
18
+ //# sourceMappingURL=no-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-data.js","sourceRoot":"","sources":["../../../../../../src/engine/services/renderer/parts/no-data/no-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,UAAU,YAAY,CAAC,IAAoB;IAC/C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,CAAC,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC;IAEvC,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,CAAC,SAAS,GAAG,GAAG,YAAY,CAAC,MAAM,QAAQ,CAAC;IAEhD,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5C,KAAK,CAAC,SAAS,GAAG,GAAG,YAAY,CAAC,MAAM,SAAS,CAAC;IAClD,KAAK,CAAC,WAAW,GAAG,mBAAmB,CAAC;IAExC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC/C,QAAQ,CAAC,SAAS,GAAG,GAAG,YAAY,CAAC,MAAM,YAAY,CAAC;IACxD,QAAQ,CAAC,WAAW,GAAG,6CAA6C,CAAC;IAErE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1B,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAE7B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC"}
package/dist/polygrid.css CHANGED
@@ -174,3 +174,59 @@
174
174
  .pg-row.last-row {
175
175
  border-bottom: 1px solid #d0d0d0;
176
176
  }
177
+
178
+ .pg-no-data {
179
+ display: flex;
180
+ flex-direction: column;
181
+ align-items: center;
182
+ justify-content: center;
183
+
184
+ height: 100%;
185
+ width: 100%;
186
+
187
+ color: #666;
188
+ font-family: sans-serif;
189
+ text-align: center;
190
+
191
+ opacity: 0.8;
192
+ pointer-events: none; /* ensures no interference with scrolling */
193
+ }
194
+
195
+ .pg-no-data__icon {
196
+ width: 48px;
197
+ height: 48px;
198
+ margin-bottom: 12px;
199
+
200
+ background: #ddd;
201
+ border-radius: 50%;
202
+
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: center;
206
+
207
+ /* simple placeholder icon */
208
+ position: relative;
209
+ }
210
+
211
+ .pg-no-data__icon::before {
212
+ content: "";
213
+ width: 24px;
214
+ height: 24px;
215
+ border: 3px solid #bbb;
216
+ border-radius: 50%;
217
+ border-top-color: transparent;
218
+ border-right-color: transparent;
219
+ transform: rotate(45deg);
220
+ display: block;
221
+ }
222
+
223
+ .pg-no-data__title {
224
+ font-size: 16px;
225
+ font-weight: 600;
226
+ margin-bottom: 4px;
227
+ }
228
+
229
+ .pg-no-data__subtitle {
230
+ font-size: 13px;
231
+ color: #999;
232
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polygrid/core",
3
- "version": "1.0.3a",
3
+ "version": "1.0.3-b",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",