@linxin666/dsh-client-ui-task-board-team 0.4.19 → 0.4.21

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.
@@ -111,6 +111,8 @@ export interface NumberConstraints {
111
111
  integer?: boolean;
112
112
  /** The accepted value must be at least this. */
113
113
  min?: number;
114
+ /** The accepted value must be at most this. */
115
+ max?: number;
114
116
  }
115
117
  /** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints stays unwritten. */
116
118
  export declare function numberField(field: string, constraints?: NumberConstraints): FieldSpec;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-client-ui-task-board-team",
3
3
  "description": "External provider extension for the dsh Web GUI task board that binds local dsh-agents members as team Agents and mirrors cloud team-hub issues onto the board; shipped as a dsh profile bundle with no DSH source changes.",
4
- "version": "0.4.19",
4
+ "version": "0.4.21",
5
5
  "icon": "icon.svg",
6
6
  "type": "module",
7
7
  "engines": {
@@ -141,11 +141,13 @@ export interface NumberConstraints {
141
141
  integer?: boolean
142
142
  /** The accepted value must be at least this. */
143
143
  min?: number
144
+ /** The accepted value must be at most this. */
145
+ max?: number
144
146
  }
145
147
 
146
148
  /** A whole- or decimal-number field. An empty draft clears the field; any other draft that is not a finite number within the constraints stays unwritten. */
147
149
  export function numberField(field: string, constraints: NumberConstraints = {}): FieldSpec {
148
- const { integer = false, min } = constraints
150
+ const { integer = false, min, max } = constraints
149
151
  return {
150
152
  field,
151
153
  entry: 'type',
@@ -157,6 +159,7 @@ export function numberField(field: string, constraints: NumberConstraints = {}):
157
159
  if (!Number.isFinite(parsed)) return undefined
158
160
  if (integer && !Number.isInteger(parsed)) return undefined
159
161
  if (min !== undefined && parsed < min) return undefined
162
+ if (max !== undefined && parsed > max) return undefined
160
163
  return { kind: 'set', value: parsed }
161
164
  },
162
165
  }
@@ -439,7 +442,7 @@ export class CardForm<T> {
439
442
  // against. Settling is the only signal the form has; the rest of the
440
443
  // batch, when one exists, still carries the atomic verdict by read-back.
441
444
  if (this.specOf(field).secret) return true
442
- return this.userLayer()?.[field] === value
445
+ return jsonValuesEqual(this.userLayer()?.[field], value)
443
446
  }
444
447
 
445
448
  /**
@@ -508,3 +511,19 @@ export class CardForm<T> {
508
511
  for (const listener of this.listeners) listener()
509
512
  }
510
513
  }
514
+
515
+ /** Structural equality for JSON settings values (primitives, arrays, plain objects). */
516
+ function jsonValuesEqual(left: unknown, right: unknown): boolean {
517
+ if (Object.is(left, right)) return true
518
+ if (typeof left !== 'object' || left === null || typeof right !== 'object' || right === null) return false
519
+ if (Array.isArray(left) || Array.isArray(right)) {
520
+ if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) return false
521
+ return left.every((item, index) => jsonValuesEqual(item, right[index]))
522
+ }
523
+ const a = left as Record<string, unknown>
524
+ const b = right as Record<string, unknown>
525
+ const keysA = Object.keys(a).filter(key => a[key] !== undefined)
526
+ const keysB = Object.keys(b).filter(key => b[key] !== undefined)
527
+ if (keysA.length !== keysB.length) return false
528
+ return keysA.every(key => Object.hasOwn(b, key) && jsonValuesEqual(a[key], b[key]))
529
+ }