@svadmin/core 0.66.2 → 0.66.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/core",
3
- "version": "0.66.2",
3
+ "version": "0.66.3",
4
4
  "author": "zuohuadong",
5
5
  "repository": {
6
6
  "type": "git",
package/src/plain-data.ts CHANGED
@@ -5,7 +5,7 @@ export function snapshotPlainData(value: unknown): JsonValue {
5
5
  function snapshot(value: unknown, ancestors: Set<object>): JsonValue {
6
6
  if (value === null || typeof value === 'string' || typeof value === 'boolean') return value;
7
7
  if (typeof value === 'number' && Number.isFinite(value)) return value;
8
- if (typeof value !== 'object' || value === null || ancestors.has(value)) {
8
+ if (typeof value !== 'object' || ancestors.has(value)) {
9
9
  throw new TypeError('Invalid plain data');
10
10
  }
11
11
  const array = Array.isArray(value);
@@ -22,7 +22,7 @@ function copySchemaData(value: unknown, ancestors = new Set<object>(), depth = 0
22
22
  if (depth > 128) return invalidSchema();
23
23
  if (value === null || value === undefined || typeof value === 'string' || typeof value === 'boolean') return value;
24
24
  if (typeof value === 'number' && Number.isFinite(value)) return value;
25
- if (typeof value !== 'object' || value === null || ancestors.has(value)) return invalidSchema();
25
+ if (typeof value !== 'object' || ancestors.has(value)) return invalidSchema();
26
26
  const array = Array.isArray(value);
27
27
  const prototype: unknown = Object.getPrototypeOf(value);
28
28
  if (!array && prototype !== Object.prototype && prototype !== null) return invalidSchema();
@@ -107,7 +107,7 @@ export function createTableQuery<TQueryFnData extends BaseRecord>(
107
107
  const merged=[...currentFilters];
108
108
  for(const nf of newFilters) {
109
109
  if(!('field' in nf)) { merged.push(nf); continue; }
110
- const idx=merged.findIndex(f => 'field' in f&&f.field===nf.field&&f.operator===nf.operator);
110
+ const idx = merged.findIndex(f => 'field' in f && f.field === nf.field && f.operator === nf.operator);
111
111
  if(idx>=0) {
112
112
  if(nf.value===undefined||nf.value===null||nf.value==='') merged.splice(idx,1);
113
113
  else merged[idx]=nf;
@@ -217,7 +217,7 @@ export function createTableQuery<TQueryFnData extends BaseRecord>(
217
217
 
218
218
  let cmp: number;
219
219
  if(typeof va==='number'&&typeof vb==='number') cmp=va-vb;
220
- else if(va instanceof Date&&vb instanceof Date) cmp=va.getTime()-vb.getTime();
220
+ else if (va instanceof Date && vb instanceof Date) cmp = va.getTime() - vb.getTime();
221
221
  else if(typeof va==='string'&&typeof vb==='string'&&!isNaN(Number(va))&&!isNaN(Number(vb))) cmp=Number(va)-Number(vb);
222
222
  else cmp=String(va).localeCompare(String(vb));
223
223
 
@@ -207,7 +207,7 @@ export class TableState {
207
207
  const merged=[...this.currentFilters];
208
208
  for(const nf of newFilters) {
209
209
  if(!('field' in nf)) { merged.push(nf); continue; }
210
- const idx=merged.findIndex(f => 'field' in f&&f.field===nf.field&&f.operator===nf.operator);
210
+ const idx = merged.findIndex(f => 'field' in f && f.field === nf.field && f.operator === nf.operator);
211
211
  if(idx>=0) {
212
212
  if(nf.value===undefined||nf.value===null||nf.value==='') merged.splice(idx,1);
213
213
  else merged[idx]=nf;