@sillsdev/config-r 1.0.0-alpha.11 → 1.0.0-alpha.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.
@@ -96,6 +96,7 @@ export declare const ConfigrForEach: React.FunctionComponent<React.PropsWithChil
96
96
  }>>;
97
97
  export declare const ConfigrBoolean: React.FunctionComponent<React.PropsWithChildren<IConfigrProps<boolean> & {
98
98
  immediateEffect?: boolean;
99
+ locked?: boolean;
99
100
  }>>;
100
101
  interface IRadioGroupProps extends IConfigrProps<string> {
101
102
  row?: boolean;
@@ -3369,7 +3369,7 @@ Lo(t, e.path)) ? null : /* @__PURE__ */ x(q.Fragment, { children: e.children })
3369
3369
  }
3370
3370
  return n;
3371
3371
  } });
3372
- return e.onClick ? /* @__PURE__ */ x(qc, { onClick: e.onClick, children: t }) : /* @__PURE__ */ x(
3372
+ return e.onClick ? /* @__PURE__ */ x(qc, { onClick: e.onClick, disabled: e.disabled, children: t }) : /* @__PURE__ */ x(
3373
3373
  gl,
3374
3374
  {
3375
3375
  css: he`
@@ -3526,12 +3526,12 @@ const CP = (e) => {
3526
3526
  e = it(e);
3527
3527
  const [t, r, n] = At(e.path);
3528
3528
  (t.value === void 0 || t.value === null) && window.setTimeout(() => n.setValue(!1), 0);
3529
- const a = e.immediateEffect ? /* @__PURE__ */ x(Ar, { component: iu, type: "checkbox", name: e.path, label: e.label }) : /* @__PURE__ */ x(
3529
+ const a = e.immediateEffect ? /* @__PURE__ */ x(Ar, { component: iu, type: "checkbox", name: e.path, label: e.label, disabled: e.disabled || e.locked }) : /* @__PURE__ */ x(
3530
3530
  Ar,
3531
3531
  {
3532
3532
  component: nu,
3533
3533
  type: "checkbox",
3534
- disabled: e.disabled,
3534
+ disabled: e.disabled || e.locked,
3535
3535
  name: e.path,
3536
3536
  label: e.label
3537
3537
  }
@@ -3540,10 +3540,11 @@ const CP = (e) => {
3540
3540
  at,
3541
3541
  {
3542
3542
  onClick: () => {
3543
- n.setValue(!t.value);
3543
+ e.locked || n.setValue(!t.value);
3544
3544
  },
3545
3545
  control: a,
3546
- ...e
3546
+ ...e,
3547
+ disabled: e.disabled && !e.locked
3547
3548
  }
3548
3549
  );
3549
3550
  }, PP = (e) => (e = it(e), // I could imagine wanting the radio buttons in the right column. There aren't any examples of this in chrome:settings.
@@ -80,7 +80,7 @@
80
80
  }
81
81
  `,children:na(e.description)})]});if(r){const a=Y.Children.toArray(e.children).filter(i=>r.exec(i.props.label)).length;if(a)return y.jsxs("div",{children:[n,y.jsx("span",{css:le.css`
82
82
  background-color: yellow;
83
- `,children:`${a} matches`})]})}return n}});return e.onClick?y.jsx(F.ListItemButton,{onClick:e.onClick,children:t}):y.jsx(F.ListItem,{css:le.css`
83
+ `,children:`${a} matches`})]})}return n}});return e.onClick?y.jsx(F.ListItemButton,{onClick:e.onClick,disabled:e.disabled,children:t}):y.jsx(F.ListItem,{css:le.css`
84
84
  height: ${e.height};
85
85
  `,children:t})};function Xe(e){const{values:t}=it();if(e.overrideValue===void 0)return e;const r=e.path.replace(/[.[\]]/g,"_");let n=t[Ft];t[Ft]||(t[Ft]=n={}),n[r]=e.overrideValue;const a=`${e.description??""} (${e.overrideDescription??""})`.replace(" ()","").trim();return{...e,description:a,disabled:!0,path:Ft+"."+r}}const Ft="overrideValue$",Ub=e=>(e=Xe(e),y.jsx(Ye,{...e,control:y.jsx(_r,{component:as,variant:"standard",name:e.path,type:e.type??"text",InputProps:e.units?{endAdornment:y.jsx(F.InputAdornment,{position:"end",children:e.units})}:void 0,css:le.css`
86
86
  input {
@@ -100,7 +100,7 @@
100
100
  margin-left: 20px;
101
101
  //margin-right: 20px;
102
102
  }
103
- `,children:y.jsx(bs,{children:e.children})})]}):y.jsx(Ye,{onClick:()=>r(e.path),control:y.jsx(sc,{}),...e})}),Jb=e=>{const{values:t}=it(),r=ms(t,e.path);return y.jsx(Y.Fragment,{children:r.map((n,a)=>e.render(`${e.path}[${a}]`,a))})},Zb=e=>{e=Xe(e);const[t,r,n]=mt(e.path);(t.value===void 0||t.value===null)&&window.setTimeout(()=>n.setValue(!1),0);const a=e.immediateEffect?y.jsx(_r,{component:ns,type:"checkbox",name:e.path,label:e.label}):y.jsx(_r,{component:ts,type:"checkbox",disabled:e.disabled,name:e.path,label:e.label});return y.jsx(Ye,{onClick:()=>{n.setValue(!t.value)},control:a,...e})},Qb=e=>(e=Xe(e),y.jsx(Vb,{...e,control:y.jsx(ey,{...e})})),ey=e=>{const[t]=mt(e.path);return y.jsx(F.RadioGroup,{row:e.row,...t,...e,children:e.children})},ty=e=>{const t=F.useRadioGroup();return console.log("useRadioGroup "+JSON.stringify(t)),e.label?y.jsx(F.FormControlLabel,{value:e.value,control:y.jsx(F.Radio,{}),label:e.label}):y.jsx(Y.Fragment,{children:e.children})},ry=e=>(e=Xe(e),y.jsx(Ye,{...e,control:y.jsx(ny,{...e})})),ny=e=>y.jsx(_r,{component:is,name:e.path,type:"checkbox",exclusive:!0,children:e.children});function ay(e,t){return y.jsx(F.ToggleButton,{value:e,children:t})}const iy=e=>{e=Xe(e);const{setFieldValue:t}=it(),[r]=mt(e.path);return y.jsx(Ye,{...e,height:"50px",control:y.jsxs("div",{css:le.css`
103
+ `,children:y.jsx(bs,{children:e.children})})]}):y.jsx(Ye,{onClick:()=>r(e.path),control:y.jsx(sc,{}),...e})}),Jb=e=>{const{values:t}=it(),r=ms(t,e.path);return y.jsx(Y.Fragment,{children:r.map((n,a)=>e.render(`${e.path}[${a}]`,a))})},Zb=e=>{e=Xe(e);const[t,r,n]=mt(e.path);(t.value===void 0||t.value===null)&&window.setTimeout(()=>n.setValue(!1),0);const a=e.immediateEffect?y.jsx(_r,{component:ns,type:"checkbox",name:e.path,label:e.label,disabled:e.disabled||e.locked}):y.jsx(_r,{component:ts,type:"checkbox",disabled:e.disabled||e.locked,name:e.path,label:e.label});return y.jsx(Ye,{onClick:()=>{e.locked||n.setValue(!t.value)},control:a,...e,disabled:e.disabled&&!e.locked})},Qb=e=>(e=Xe(e),y.jsx(Vb,{...e,control:y.jsx(ey,{...e})})),ey=e=>{const[t]=mt(e.path);return y.jsx(F.RadioGroup,{row:e.row,...t,...e,children:e.children})},ty=e=>{const t=F.useRadioGroup();return console.log("useRadioGroup "+JSON.stringify(t)),e.label?y.jsx(F.FormControlLabel,{value:e.value,control:y.jsx(F.Radio,{}),label:e.label}):y.jsx(Y.Fragment,{children:e.children})},ry=e=>(e=Xe(e),y.jsx(Ye,{...e,control:y.jsx(ny,{...e})})),ny=e=>y.jsx(_r,{component:is,name:e.path,type:"checkbox",exclusive:!0,children:e.children});function ay(e,t){return y.jsx(F.ToggleButton,{value:e,children:t})}const iy=e=>{e=Xe(e);const{setFieldValue:t}=it(),[r]=mt(e.path);return y.jsx(Ye,{...e,height:"50px",control:y.jsxs("div",{css:le.css`
104
104
  height: 56px; // leave room to show the path below the button
105
105
  `,children:[y.jsx(F.Button,{disabled:e.disabled,variant:"outlined",onClick:()=>{const n=e.chooseAction(r.value);t(e.path,n)},children:e.buttonLabel}),y.jsx("div",{css:le.css`
106
106
  color: ${Lb};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sillsdev/config-r",
3
- "version": "1.0.0-alpha.11",
3
+ "version": "1.0.0-alpha.13",
4
4
  "license": "MIT",
5
5
  "packageManager": "yarn@1.22.19",
6
6
  "keywords": [