@kubex/zinc 1.1.150 → 1.1.152

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.
@@ -8983,6 +8983,16 @@
8983
8983
  "description": "When set, the table's non-default state (search, filter, sort, page, per-page and field values)\nis mirrored to the URL query string and restored from it on load, so the view is shareable.",
8984
8984
  "attribute": "sharable"
8985
8985
  },
8986
+ {
8987
+ "kind": "field",
8988
+ "name": "wrapSearchFields",
8989
+ "type": {
8990
+ "text": "boolean"
8991
+ },
8992
+ "default": "false",
8993
+ "description": "When set, extra request params (search-component field values) are nested under a\n`searchFields` object - with `q` mirroring the search text - instead of being merged at the\nroot of the request body.",
8994
+ "attribute": "wrap-search-fields"
8995
+ },
8986
8996
  {
8987
8997
  "kind": "field",
8988
8998
  "name": "groupBy",
@@ -9165,7 +9175,7 @@
9165
9175
  "kind": "field",
9166
9176
  "name": "_dataTask",
9167
9177
  "privacy": "private",
9168
- "default": "new Task(this, { task: async ([dataUri, requestParams], {signal}) => { // Every request path funnels through the task, so this is the single place to mirror the // current (non-default) state to the URL when `sharable` is set. this._updateSharableUrl(); if (dataUri === undefined || this.noInitialLoad && this._initialLoad) { return {rows: [], page: 1, perPage: this.itemsPerPage, total: 0}; } if (this.groupBy) { // we want to load all the data possible so we can group and show multiple tables this.itemsPerPage = 1000; } const requestData: DataRequest = { page: this.page, perPage: this.itemsPerPage, sortColumn: this.sortColumn, sortDirection: this.sortDirection, filter: this.filter, search: this.search, }; // Inputs-slot values are context/system params (e.g. csrf token, package name) sent with // every request - they stay at the root of the payload. const inputs = this.hasSlotController.getSlots(ActionSlots.inputs.valueOf()); const params: Record<string, any> = {}; if (inputs) { inputs.forEach((input) => { const allowedInputs = ['zn-input', 'zn-select', 'zn-query-builder', 'zn-multiselect', 'zn-params-select', 'zn-datepicker', 'input', 'select', 'textarea']; if (allowedInputs.includes(input.tagName.toLowerCase())) { const value = (input as AllowedInputElement).value as string || input.getAttribute('value'); const name = (input as AllowedInputElement).name || input.getAttribute('name'); if (name) { params[name] = value; } } }); Object.assign(requestData, params); } // Search-related fields (from <zn-data-table-search>'s `fields` slot, delivered via // requestParams) are wrapped under `searchFields` so the backend can bind them to a single // map rather than arbitrary root-level keys. `q` mirrors the search text; the root `search` // key is still sent for back-compatibility. Empty values are dropped, and `searchFields` is // null when nothing meaningful remains so the backend can treat it as \"no search\". const searchFields: Record<string, any> = {}; if (requestParams && typeof requestParams === 'object') { for (const [key, value] of Object.entries(requestParams as Record<string, unknown>)) { if (value !== undefined && value !== null && value !== '') { searchFields[key] = value; } } } if (this.search || Object.keys(searchFields).length > 0) { searchFields.q = this.search; } requestData.searchFields = Object.keys(searchFields).length > 0 ? searchFields : null; // This is also used for Rubix, so it may not work for your application. const response = await fetch(dataUri, { method: this.method, headers: { 'x-kx-fetch-style': 'zn-data-table', }, signal, credentials: 'same-origin', body: this.method === 'POST' ? JSON.stringify(requestData) : undefined }); if (!response.ok) throw new Error(response.statusText); return response.json(); }, args: () => [this.dataUri, this.requestParams] })"
9178
+ "default": "new Task(this, { task: async ([dataUri, requestParams], {signal}) => { // Every request path funnels through the task, so this is the single place to mirror the // current (non-default) state to the URL when `sharable` is set. this._updateSharableUrl(); if (dataUri === undefined || this.noInitialLoad && this._initialLoad) { return {rows: [], page: 1, perPage: this.itemsPerPage, total: 0}; } if (this.groupBy) { // we want to load all the data possible so we can group and show multiple tables this.itemsPerPage = 1000; } const requestData: DataRequest = { page: this.page, perPage: this.itemsPerPage, sortColumn: this.sortColumn, sortDirection: this.sortDirection, filter: this.filter, search: this.search, }; // Inputs-slot values are context/system params (e.g. csrf token, package name) sent with // every request. const inputs = this.hasSlotController.getSlots(ActionSlots.inputs.valueOf()); const params: Record<string, any> = {}; if (inputs) { inputs.forEach((input) => { const allowedInputs = ['zn-input', 'zn-select', 'zn-query-builder', 'zn-multiselect', 'zn-params-select', 'zn-datepicker', 'input', 'select', 'textarea']; if (allowedInputs.includes(input.tagName.toLowerCase())) { const value = (input as AllowedInputElement).value as string || input.getAttribute('value'); const name = (input as AllowedInputElement).name || input.getAttribute('name'); if (name) { params[name] = value; } } }); Object.assign(requestData, params); } // Add any extra request params const extraParams = requestParams && typeof requestParams === 'object' ? requestParams as Record<string, unknown> : {}; if (this.wrapSearchFields) { // Opt-in shape: field values nested under `searchFields`, with `q` mirroring the search // text, so a backend can bind them to one map. Empty values are dropped, and the key is // null when nothing is set. The root `search` key is sent either way. const searchFields: Record<string, any> = {}; for (const [key, value] of Object.entries(extraParams)) { if (value !== undefined && value !== null && value !== '') { searchFields[key] = value; } } if (this.search || Object.keys(searchFields).length > 0) { searchFields.q = this.search; } requestData.searchFields = Object.keys(searchFields).length > 0 ? searchFields : null; } else { Object.assign(requestData, extraParams); } // This is also used for Rubix, so it may not work for your application. const response = await fetch(dataUri, { method: this.method, headers: { 'x-kx-fetch-style': 'zn-data-table', }, signal, credentials: 'same-origin', body: this.method === 'POST' ? JSON.stringify(requestData) : undefined }); if (!response.ok) throw new Error(response.statusText); return response.json(); }, args: () => [this.dataUri, this.requestParams] })"
9169
9179
  },
9170
9180
  {
9171
9181
  "kind": "field",
@@ -10184,6 +10194,15 @@
10184
10194
  "description": "When set, the table's non-default state (search, filter, sort, page, per-page and field values)\nis mirrored to the URL query string and restored from it on load, so the view is shareable.",
10185
10195
  "fieldName": "sharable"
10186
10196
  },
10197
+ {
10198
+ "name": "wrap-search-fields",
10199
+ "type": {
10200
+ "text": "boolean"
10201
+ },
10202
+ "default": "false",
10203
+ "description": "When set, extra request params (search-component field values) are nested under a\n`searchFields` object - with `q` mirroring the search text - instead of being merged at the\nroot of the request body.",
10204
+ "fieldName": "wrapSearchFields"
10205
+ },
10187
10206
  {
10188
10207
  "name": "group-by",
10189
10208
  "type": {
@@ -26695,7 +26714,7 @@
26695
26714
  "name": "pageSlotController",
26696
26715
  "privacy": "private",
26697
26716
  "readonly": true,
26698
- "default": "new HasSlotController(this, 'breadcrumb', 'actions', 'caption')"
26717
+ "default": "new HasSlotController(this, 'breadcrumb', 'actions', 'caption', 'description')"
26699
26718
  },
26700
26719
  {
26701
26720
  "kind": "field",
@@ -53493,7 +53512,7 @@
53493
53512
  "package": {
53494
53513
  "name": "@kubex/zinc",
53495
53514
  "description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
53496
- "version": "1.1.150",
53515
+ "version": "1.1.152",
53497
53516
  "author": "",
53498
53517
  "license": "MIT"
53499
53518
  }
@@ -1234,6 +1234,11 @@
1234
1234
  "description": "When set, the table's non-default state (search, filter, sort, page, per-page and field values)\nis mirrored to the URL query string and restored from it on load, so the view is shareable.",
1235
1235
  "values": []
1236
1236
  },
1237
+ {
1238
+ "name": "wrap-search-fields",
1239
+ "description": "When set, extra request params (search-component field values) are nested under a\n`searchFields` object - with `q` mirroring the search text - instead of being merged at the\nroot of the request body.",
1240
+ "values": []
1241
+ },
1237
1242
  { "name": "group-by", "values": [] },
1238
1243
  { "name": "groups", "values": [] },
1239
1244
  { "name": "per-page-size", "values": [] }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@kubex/zinc",
4
- "version": "1.1.150",
4
+ "version": "1.1.152",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -2766,6 +2766,11 @@
2766
2766
  "description": "When set, the table's non-default state (search, filter, sort, page, per-page and field values)\nis mirrored to the URL query string and restored from it on load, so the view is shareable.",
2767
2767
  "value": { "type": "boolean", "default": "false" }
2768
2768
  },
2769
+ {
2770
+ "name": "wrap-search-fields",
2771
+ "description": "When set, extra request params (search-component field values) are nested under a\n`searchFields` object - with `q` mirroring the search text - instead of being merged at the\nroot of the request body.",
2772
+ "value": { "type": "boolean", "default": "false" }
2773
+ },
2769
2774
  {
2770
2775
  "name": "group-by",
2771
2776
  "value": { "type": "string", "default": "''" }
@@ -2859,6 +2864,11 @@
2859
2864
  "description": "When set, the table's non-default state (search, filter, sort, page, per-page and field values)\nis mirrored to the URL query string and restored from it on load, so the view is shareable.",
2860
2865
  "type": "boolean"
2861
2866
  },
2867
+ {
2868
+ "name": "wrapSearchFields",
2869
+ "description": "When set, extra request params (search-component field values) are nested under a\n`searchFields` object - with `q` mirroring the search text - instead of being merged at the\nroot of the request body.",
2870
+ "type": "boolean"
2871
+ },
2862
2872
  { "name": "groupBy", "type": "string" },
2863
2873
  { "name": "groups", "type": "string" },
2864
2874
  { "name": "itemsPerPage", "type": "number" },
package/dist/zn.d.ts CHANGED
@@ -4192,6 +4192,12 @@ declare module "components/data-table/data-table.component" {
4192
4192
  *is mirrored to the URL query string and restored from it on load, so the view is shareable.
4193
4193
  */
4194
4194
  sharable: boolean;
4195
+ /**
4196
+ * When set, extra request params (search-component field values) are nested under a
4197
+ * `searchFields` object - with `q` mirroring the search text - instead of being merged at the
4198
+ * root of the request body.
4199
+ */
4200
+ wrapSearchFields: boolean;
4195
4201
  groupBy: string;
4196
4202
  groups: string;
4197
4203
  itemsPerPage: number;