{"id":24989683,"url":"https://github.com/weishaodaren/polaris-react-formula","last_synced_at":"2025-04-12T01:20:20.644Z","repository":{"id":62624384,"uuid":"560679265","full_name":"weishaodaren/polaris-react-formula","owner":"weishaodaren","description":"极星公式库 ✨","archived":false,"fork":false,"pushed_at":"2023-05-19T05:13:30.000Z","size":465,"stargazers_count":6,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T17:02:11.314Z","etag":null,"topics":["antd","codemirror","formula","pnpm","react","typescript","vite"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/polaris-react-formula","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weishaodaren.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-02T02:39:52.000Z","updated_at":"2024-05-06T19:54:57.000Z","dependencies_parsed_at":"2024-10-30T16:04:55.209Z","dependency_job_id":"f88c6506-0044-458d-b2cb-c0096c55465e","html_url":"https://github.com/weishaodaren/polaris-react-formula","commit_stats":{"total_commits":227,"total_committers":3,"mean_commits":75.66666666666667,"dds":0.09691629955947134,"last_synced_commit":"9bc43f76482c9def1e58b5d0f0d6ae396f6cf1c5"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weishaodaren%2Fpolaris-react-formula","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weishaodaren%2Fpolaris-react-formula/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weishaodaren%2Fpolaris-react-formula/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weishaodaren%2Fpolaris-react-formula/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weishaodaren","download_url":"https://codeload.github.com/weishaodaren/polaris-react-formula/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501856,"owners_count":21114684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["antd","codemirror","formula","pnpm","react","typescript","vite"],"created_at":"2025-02-04T13:03:11.201Z","updated_at":"2025-04-12T01:20:20.619Z","avatar_url":"https://github.com/weishaodaren.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 极星公式库 polaris-react-formula\n\n\u003e Formula compiler core.\n\nSee our website https://app.startable.cn/\n\n### 📕 Install\n\nUsing npm:\n\n```js\nnpm install --save polaris-react-formula\n```\n\nor using yarn:\n\n```js\nyarn add polaris-react-formula\n```\n\nor useing pnpm:\n\n```js\npnpm install polaris-react-formula\n```\n\n### 📘 Type\n|Property|Type|Description|Default Value|\n|----|----|---|----|\n|visible|`boolean`|控制Modal显示隐藏|`false`|\n|value|`string`|公式值|`''`|\n|className|`string`|类名|`''`|\n|style|`React.CSSProperties`|类名|`''`|\n|field|`IColumn`|字段 列||\n|onClose|`(() =\u003e void)`|关闭Modal||\n|onChange|`(formula: string, formulaField: string ) =\u003e void)`|获取计算值 回调|`undefined`|\n|onLink|`(() =\u003e void)`|跳转外链|`undefined`|\n\n### 📖 Usage\n```js\nimport React, { useCallback, useState } from 'react';\nimport FormulaEditor, { useFormula } from 'polaris-react-formula';\n\nfunction App() {\n  const [visible, setVisible] = useState(true);\n  const [value, setValue] = useState('IF({title} = \"刘123建\", {title}, {ownerId})');\n\n  const onCalc = useCallback((formula: string, formulaField: string) =\u003e {\n    setValue(formulaField);\n    console.log('%c Formula:', 'color: pink', formula);\n    console.log('%c Field:', 'color: orange', formulaField);\n\n    const res = useFormula(formula, dataSource[0]);\n    console.log('%c Result:', 'color: yellow', res);\n  }, []);\n\n  const onClose = useCallback(() =\u003e {\n    setVisible(false);\n  }, []);\n\n  return (\n    \u003c\u003e\n      \u003cbutton onClick={() =\u003e setVisible(true)}\u003eClick Me\u003c/button\u003e\n      \u003cFormulaEditor\n        visible={visible}\n        value={value}\n        field={column}\n        onChange={onCalc}\n        onClose={onClose}\n        /\u003e\n      \u003c/\u003e\n  );\n}\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweishaodaren%2Fpolaris-react-formula","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweishaodaren%2Fpolaris-react-formula","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweishaodaren%2Fpolaris-react-formula/lists"}