ag-common 0.0.271 → 0.0.274

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.
@@ -43,7 +43,8 @@ export declare function objectToString(obj: Record<string, string>, joinKeyValue
43
43
  * @returns
44
44
  */
45
45
  export declare const castObject: <TIn, TOut>(orig: Record<string, TIn>, castF: (t: TIn) => TOut) => Record<string, TOut>;
46
- export declare const removeUndefValuesFromObject: <T>(orig: Record<string, T>) => Record<string, T>;
46
+ /** remove key values from an object where the value is null or undefined or other specific passed in values */
47
+ export declare const removeUndefValuesFromObject: <T>(orig: Record<string, T>, ...additionalRemoves: T[]) => Record<string, T>;
47
48
  /**
48
49
  * cast Record<string,string[]|string> to Record<string,string>. can be used for querystring params
49
50
  * @param orig
@@ -128,10 +128,13 @@ const castObject = (orig, castF) => {
128
128
  return ret;
129
129
  };
130
130
  exports.castObject = castObject;
131
- const removeUndefValuesFromObject = (orig) => {
131
+ /** remove key values from an object where the value is null or undefined or other specific passed in values */
132
+ const removeUndefValuesFromObject = (orig,
133
+ /** other than null or undefined */
134
+ ...additionalRemoves) => {
132
135
  const ret = {};
133
136
  Object.entries(orig).forEach(([k, v]) => {
134
- if (v !== null && v !== undefined) {
137
+ if (v !== null && v !== undefined && !(additionalRemoves === null || additionalRemoves === void 0 ? void 0 : additionalRemoves.includes(v))) {
135
138
  ret[k] = v;
136
139
  }
137
140
  });
@@ -30,7 +30,6 @@ exports.RadioGroup = void 0;
30
30
  const common_1 = require("./common");
31
31
  const FlexColumn_1 = require("../FlexColumn");
32
32
  const common_2 = require("../../styles/common");
33
- const math_1 = require("../../../common/helpers/math");
34
33
  const react_1 = __importStar(require("react"));
35
34
  const styled_components_1 = __importDefault(require("styled-components"));
36
35
  const Label = styled_components_1.default.label ``;
@@ -39,7 +38,6 @@ const RadioGroup = ({ defaultValue, onSubmit, values,
39
38
  renderLabel = (e) => e.toString(),
40
39
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
40
  renderValue = (e) => e.toString(), }) => {
42
- const [name] = (0, react_1.useState)((0, math_1.getRandomInt)(10000).toString());
43
41
  const [value, setValue] = (0, react_1.useState)(renderValue(defaultValue));
44
42
  (0, react_1.useEffect)(() => {
45
43
  const rv = renderValue(defaultValue);
@@ -47,8 +45,10 @@ renderValue = (e) => e.toString(), }) => {
47
45
  setValue(rv);
48
46
  }
49
47
  }, [defaultValue, renderValue, value]);
50
- return (react_1.default.createElement(common_1.ValueBox, Object.assign({}, common_2.noDrag), values.map((v) => (react_1.default.createElement(FlexColumn_1.FlexColumn, { key: name + v },
48
+ return (react_1.default.createElement(common_1.ValueBox, Object.assign({}, common_2.noDrag), values.map((v) => (
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ react_1.default.createElement(FlexColumn_1.FlexColumn, { key: v.toString() },
51
51
  react_1.default.createElement(Label, null, renderLabel(v)),
52
- react_1.default.createElement("input", { type: "radio", key: renderValue(v), value: renderValue(v), name: name, checked: renderValue(v) === value, onChange: () => onSubmit(v) }))))));
52
+ react_1.default.createElement("input", { type: "radio", key: renderValue(v), value: renderValue(v), checked: renderValue(v) === value, onChange: () => onSubmit(v) }))))));
53
53
  };
54
54
  exports.RadioGroup = RadioGroup;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.271",
3
+ "version": "0.0.274",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",
@@ -30,7 +30,7 @@
30
30
  "typescript": "4.x"
31
31
  },
32
32
  "devDependencies": {
33
- "@babel/core": "7.18.5",
33
+ "@babel/core": "7.18.6",
34
34
  "@storybook/addon-actions": "6.5.9",
35
35
  "@storybook/addon-docs": "6.5.9",
36
36
  "@storybook/addon-essentials": "6.5.9",
@@ -44,16 +44,16 @@
44
44
  "@types/react": "17.0.43",
45
45
  "@types/react-dom": "17.0.14",
46
46
  "@types/styled-components": "5.1.25",
47
- "@typescript-eslint/eslint-plugin": "5.29.0",
48
- "@typescript-eslint/parser": "5.29.0",
47
+ "@typescript-eslint/eslint-plugin": "5.30.0",
48
+ "@typescript-eslint/parser": "5.30.0",
49
49
  "cross-env": "7.0.3",
50
50
  "eslint": "8.18.0",
51
51
  "eslint-config-airbnb-typescript": "17.0.0",
52
52
  "eslint-config-prettier": "8.5.0",
53
53
  "eslint-plugin-import": "2.26.0",
54
- "eslint-plugin-jsx-a11y": "6.5.1",
55
- "eslint-plugin-prettier": "4.0.0",
56
- "eslint-plugin-react": "7.30.0",
54
+ "eslint-plugin-jsx-a11y": "6.6.0",
55
+ "eslint-plugin-prettier": "4.2.1",
56
+ "eslint-plugin-react": "7.30.1",
57
57
  "eslint-plugin-react-hooks": "4.6.0",
58
58
  "prettier": "2.7.1",
59
59
  "rimraf": "3.0.2"