aldehyde 0.2.197 → 0.2.199
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/LICENSE +201 -201
- package/README.md +2 -2
- package/lib/custom-page/def-custom-page.d.ts.map +1 -1
- package/lib/custom-page/dtmpl-custom-edit-modal-page.d.ts.map +1 -1
- package/lib/detail/dtmpl.css +57 -57
- package/lib/export/export-frame.css +2 -2
- package/lib/export/export-frame.d.ts.map +1 -1
- package/lib/export/select-code-export-frame.d.ts.map +1 -1
- package/lib/form/dtmpl-form.css +3 -3
- package/lib/form/dtmpl-form.d.ts.map +1 -1
- package/lib/form/field-group-form.d.ts.map +1 -1
- package/lib/form/form-Item-group.d.ts.map +1 -1
- package/lib/form/index.css +12 -12
- package/lib/hooks/useVarCssColor.d.ts.map +1 -1
- package/lib/import/excel-import.d.ts.map +1 -1
- package/lib/import/index.css +53 -53
- package/lib/import/template.css +50 -50
- package/lib/layout/common.css +64 -64
- package/lib/layout/coverstyle.css +51 -51
- package/lib/layout2/LayoutContext.d.ts.map +1 -1
- package/lib/locale/LocaleButton.d.ts.map +1 -1
- package/lib/locale/LocaleProvider.d.ts.map +1 -1
- package/lib/locale/langMp.d.ts.map +1 -1
- package/lib/locale/translate.d.ts.map +1 -1
- package/lib/locale/useLocale.d.ts.map +1 -1
- package/lib/login/index.css +19 -19
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login2/Login.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-card.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
- package/lib/module/dtmpl-editor.d.ts.map +1 -1
- package/lib/module/dtmpl-view-card.d.ts.map +1 -1
- package/lib/module/embed-dtmpl-edit-page.d.ts.map +1 -1
- package/lib/module/ltmpl-modal.d.ts.map +1 -1
- package/lib/module/ltmpl-table.d.ts.map +1 -1
- package/lib/routable/dtmpl-route.d.ts.map +1 -1
- package/lib/routable/dtmpl-route.js +1 -1
- package/lib/routable/dtmpl-route.js.map +1 -1
- package/lib/routable/withroute.d.ts.map +1 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +2 -1
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/control-table-x-axis-wrapper.d.ts +2 -11
- package/lib/table/control-table-x-axis-wrapper.d.ts.map +1 -1
- package/lib/table/index.css +71 -71
- package/lib/table/l2-act-table.d.ts.map +1 -1
- package/lib/table/modal-select-table.d.ts.map +1 -1
- package/lib/table/pagination.css +14 -14
- package/lib/table/pagination.d.ts.map +1 -1
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/select-table.d.ts.map +1 -1
- package/lib/table/selected-rows-card.d.ts.map +1 -1
- package/lib/tmpl/control-type-supportor.d.ts.map +1 -1
- package/lib/tmpl/hc-data-source.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/interface.d.ts +1 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
- package/lib/tree/act-tree.d.ts.map +1 -1
- package/lib/tree/block-menu-auth-tree.d.ts.map +1 -1
- package/lib/tree/index.css +20 -20
- package/lib/tree/tmpl-tree.d.ts.map +1 -1
- package/lib/tree/tree-node.d.ts.map +1 -1
- package/lib/tree/tree-utils.d.ts.map +1 -1
- package/lib/utils/dsu.d.ts.map +1 -1
- package/lib/welcome/index.css +13 -13
- package/lib/welcome/quick-entrance.d.ts.map +1 -1
- package/lib/welcome/workbench.d.ts.map +1 -1
- package/package.json +206 -206
- package/src/aldehyde/controls/action/index.css +8 -8
- package/src/aldehyde/controls/action/index.tsx +396 -401
- package/src/aldehyde/controls/action/utils.tsx +307 -307
- package/src/aldehyde/controls/auto-complete/index.tsx +82 -82
- package/src/aldehyde/controls/cascader/index.tsx +112 -112
- package/src/aldehyde/controls/chemstruc/graph.tsx +184 -184
- package/src/aldehyde/controls/chemstruc/index.css +28 -28
- package/src/aldehyde/controls/code-editor/sql-code-editor.tsx +73 -73
- package/src/aldehyde/controls/collapse-card/index.css +8 -8
- package/src/aldehyde/controls/collapse-card/index.tsx +109 -109
- package/src/aldehyde/controls/color-picker/index.css +26 -26
- package/src/aldehyde/controls/color-picker/index.tsx +114 -114
- package/src/aldehyde/controls/counting-tag/index.tsx +53 -53
- package/src/aldehyde/controls/cquery/cquick-button.tsx +144 -144
- package/src/aldehyde/controls/date-picker/index.tsx +146 -146
- package/src/aldehyde/controls/entity-select/entity-select.tsx +724 -723
- package/src/aldehyde/controls/entity-select/index.css +6 -6
- package/src/aldehyde/controls/entity-select/lab-tree-select.tsx +154 -154
- package/src/aldehyde/controls/entity-select/popover-entity-select.tsx +190 -190
- package/src/aldehyde/controls/entry-control.tsx +359 -359
- package/src/aldehyde/controls/enum-badge/index.tsx +31 -31
- package/src/aldehyde/controls/enum-tag/index.tsx +35 -35
- package/src/aldehyde/controls/field-history/index.tsx +81 -81
- package/src/aldehyde/controls/file-export/select-code-export.tsx +40 -40
- package/src/aldehyde/controls/file-view/drawer-file-view.tsx +75 -75
- package/src/aldehyde/controls/file-view/index.tsx +142 -142
- package/src/aldehyde/controls/file-view/newin-file-view.tsx +40 -40
- package/src/aldehyde/controls/html-editor/draft.tsx +161 -161
- package/src/aldehyde/controls/html-editor/tinymce.js +54 -54
- package/src/aldehyde/controls/input-number/index.tsx +148 -148
- package/src/aldehyde/controls/input-range/index.tsx +59 -59
- package/src/aldehyde/controls/password-setter/index.css +2 -2
- package/src/aldehyde/controls/password-setter/index.js +88 -88
- package/src/aldehyde/controls/progress/index.tsx +74 -74
- package/src/aldehyde/controls/relation-existion/index.css +4 -4
- package/src/aldehyde/controls/relation-existion/index.tsx +140 -140
- package/src/aldehyde/controls/rfield/index.css +4 -4
- package/src/aldehyde/controls/rfield/index.tsx +226 -226
- package/src/aldehyde/controls/select/index.tsx +211 -211
- package/src/aldehyde/controls/signature/index.tsx +226 -226
- package/src/aldehyde/controls/steps/index.tsx +59 -59
- package/src/aldehyde/controls/text/ellipsis-text.tsx +96 -96
- package/src/aldehyde/controls/upload/index.tsx +138 -138
- package/src/aldehyde/controls/view-control.tsx +284 -284
- package/src/aldehyde/custom-page/custom-page-router.tsx +75 -75
- package/src/aldehyde/custom-page/def-custom-page.tsx +17 -17
- package/src/aldehyde/custom-page/dtmpl-custom-edit-modal-page.tsx +87 -87
- package/src/aldehyde/detail/button/bottom-submit-button-bar.tsx +90 -90
- package/src/aldehyde/detail/button/cquery-button-bar.tsx +144 -144
- package/src/aldehyde/detail/button/edit-button.tsx +62 -62
- package/src/aldehyde/detail/button/fix-right-submit-button-bar.tsx +178 -178
- package/src/aldehyde/detail/button/index.css +42 -42
- package/src/aldehyde/detail/button/submit-button-bar.tsx +56 -56
- package/src/aldehyde/detail/button/view-button.tsx +61 -61
- package/src/aldehyde/detail/dtmpl.css +57 -57
- package/src/aldehyde/detail/edit/dtmpl-edit.tsx +267 -267
- package/src/aldehyde/detail/edit/fields-edit-card.tsx +143 -143
- package/src/aldehyde/detail/edit/modal-row-edit.tsx +94 -94
- package/src/aldehyde/detail/edit/post-result/index.tsx +85 -85
- package/src/aldehyde/detail/edit/row-edit-card.tsx +179 -179
- package/src/aldehyde/detail/edit/row-editor.tsx +72 -72
- package/src/aldehyde/detail/rightbar/index.css +34 -34
- package/src/aldehyde/detail/rightbar/index.tsx +92 -92
- package/src/aldehyde/detail/tooltipbar/index.tsx +32 -32
- package/src/aldehyde/detail/view/act-dtmpl-view.tsx +286 -271
- package/src/aldehyde/detail/view/dtmpl-view.tsx +319 -319
- package/src/aldehyde/detail/view/field-view-group.tsx +83 -83
- package/src/aldehyde/detail/view/modal-dtmpl-view.tsx +72 -72
- package/src/aldehyde/detail/view/snapshot-timeline.tsx +164 -164
- package/src/aldehyde/export/export-frame.css +2 -2
- package/src/aldehyde/export/export-frame.tsx +299 -299
- package/src/aldehyde/export/select-code-export-frame.tsx +218 -218
- package/src/aldehyde/form/criteria-form.tsx +488 -488
- package/src/aldehyde/form/dtmpl-form.css +3 -3
- package/src/aldehyde/form/dtmpl-form.tsx +502 -502
- package/src/aldehyde/form/field-group-form.tsx +98 -98
- package/src/aldehyde/form/fields-form.tsx +44 -44
- package/src/aldehyde/form/form-Item-group.tsx +211 -211
- package/src/aldehyde/form/index.css +12 -12
- package/src/aldehyde/hooks/useVarCssColor.ts +6 -6
- package/src/aldehyde/icon/index.tsx +28 -28
- package/src/aldehyde/import/excel-import.tsx +450 -450
- package/src/aldehyde/import/index.css +53 -53
- package/src/aldehyde/import/template.css +50 -50
- package/src/aldehyde/index.tsx +176 -176
- package/src/aldehyde/layout/MainPage.tsx +334 -334
- package/src/aldehyde/layout/common.css +64 -64
- package/src/aldehyde/layout/coverstyle.css +51 -51
- package/src/aldehyde/layout/footer/index.css +5 -5
- package/src/aldehyde/layout/footer/index.js +17 -17
- package/src/aldehyde/layout/header/index.css +122 -122
- package/src/aldehyde/layout/header/index.tsx +145 -145
- package/src/aldehyde/layout/menu/block.css +7 -7
- package/src/aldehyde/layout/menu/block.tsx +174 -174
- package/src/aldehyde/layout/menu/l2menu-message-bar.tsx +161 -161
- package/src/aldehyde/layout/menu/l2menu-quick-bar.tsx +159 -159
- package/src/aldehyde/layout/menu/menu-2layers.tsx +117 -117
- package/src/aldehyde/layout/menu/menu-render.tsx +165 -165
- package/src/aldehyde/layout/menu/reset-password.tsx +255 -255
- package/src/aldehyde/layout/menu/user-bar.tsx +258 -258
- package/src/aldehyde/layout/menu/userinfo-bar.tsx +69 -69
- package/src/aldehyde/layout/sidebar/index.css +57 -57
- package/src/aldehyde/layout/sidebar/index.tsx +85 -85
- package/src/aldehyde/layout2/LayoutContext.tsx +95 -95
- package/src/aldehyde/layout2/components/userButton.tsx +171 -171
- package/src/aldehyde/layout2/css/header.css +38 -38
- package/src/aldehyde/layout2/header.tsx +371 -371
- package/src/aldehyde/layout2/main.tsx +27 -27
- package/src/aldehyde/layout2/page.tsx +189 -189
- package/src/aldehyde/layout2/sider.tsx +335 -335
- package/src/aldehyde/layout2/type/layout.type.ts +10 -10
- package/src/aldehyde/layout2/util/menu.util.tsx +122 -122
- package/src/aldehyde/locale/LocaleButton.tsx +47 -47
- package/src/aldehyde/locale/LocaleProvider.tsx +204 -204
- package/src/aldehyde/locale/langMp.ts +45 -45
- package/src/aldehyde/locale/translate.ts +80 -80
- package/src/aldehyde/locale/useLocale.ts +56 -56
- package/src/aldehyde/login/context-setter.tsx +130 -130
- package/src/aldehyde/login/index.css +19 -19
- package/src/aldehyde/login/login.tsx +252 -252
- package/src/aldehyde/login/router-login.tsx +107 -107
- package/src/aldehyde/login/vertify/index.css +143 -143
- package/src/aldehyde/login/vertify/index.tsx +360 -360
- package/src/aldehyde/login/vertify/tool.ts +13 -13
- package/src/aldehyde/login2/Login.tsx +203 -203
- package/src/aldehyde/login2/LoginPage.tsx +64 -64
- package/src/aldehyde/login2/index.tsx +4 -4
- package/src/aldehyde/module/block-menu-tree-drawer.tsx +116 -116
- package/src/aldehyde/module/criteria-page.tsx1 +175 -175
- package/src/aldehyde/module/dtmpl-edit-card.tsx +313 -313
- package/src/aldehyde/module/dtmpl-edit-drawer.tsx +23 -23
- package/src/aldehyde/module/dtmpl-edit-modal.tsx +25 -25
- package/src/aldehyde/module/dtmpl-edit-page.tsx +396 -396
- package/src/aldehyde/module/dtmpl-editor.tsx +162 -162
- package/src/aldehyde/module/dtmpl-view-card.tsx +73 -73
- package/src/aldehyde/module/dtmpl-view-drawer.tsx +64 -64
- package/src/aldehyde/module/dtmpl-view-modal.tsx +53 -53
- package/src/aldehyde/module/embed-dtmpl-edit-page.tsx +137 -137
- package/src/aldehyde/module/ltmpl-drawer.tsx +57 -57
- package/src/aldehyde/module/ltmpl-modal.tsx +62 -62
- package/src/aldehyde/module/ltmpl-table.tsx +375 -375
- package/src/aldehyde/routable/dtmpl-route.tsx +166 -165
- package/src/aldehyde/routable/import-route.tsx +34 -34
- package/src/aldehyde/routable/ltmpl-route.tsx +436 -436
- package/src/aldehyde/routable/ttmpl-route.tsx +95 -95
- package/src/aldehyde/routable/withroute.tsx +25 -25
- package/src/aldehyde/table/act-table.tsx +1737 -1732
- package/src/aldehyde/table/column/column-selector.tsx +130 -130
- package/src/aldehyde/table/column/index.css +13 -13
- package/src/aldehyde/table/control-table-x-axis-wrapper.tsx +80 -80
- package/src/aldehyde/table/index.css +71 -71
- package/src/aldehyde/table/l2-act-table.tsx +91 -91
- package/src/aldehyde/table/modal-select-table.tsx +278 -278
- package/src/aldehyde/table/pagination.css +14 -14
- package/src/aldehyde/table/pagination.tsx +76 -76
- package/src/aldehyde/table/query-table.tsx +1421 -1421
- package/src/aldehyde/table/relation-table.tsx +855 -855
- package/src/aldehyde/table/select-table.tsx +272 -272
- package/src/aldehyde/table/selected-rows-card.tsx +75 -75
- package/src/aldehyde/table/stat/restat.tsx +123 -123
- package/src/aldehyde/table/table-util.tsx +25 -25
- package/src/aldehyde/tmpl/control-type-supportor.tsx +111 -111
- package/src/aldehyde/tmpl/hc-data-source.tsx +514 -514
- package/src/aldehyde/tmpl/hcservice-v3.tsx +1226 -1226
- package/src/aldehyde/tmpl/interface.tsx +614 -612
- package/src/aldehyde/tmpl/model-struc-v3.tsx +107 -107
- package/src/aldehyde/tmpl/superagent.js +165 -165
- package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +342 -342
- package/src/aldehyde/tree/act-tree.tsx +220 -220
- package/src/aldehyde/tree/block-menu-auth-tree.tsx +187 -187
- package/src/aldehyde/tree/index.css +20 -20
- package/src/aldehyde/tree/tmpl-tree.tsx +678 -678
- package/src/aldehyde/tree/tree-node.tsx +73 -73
- package/src/aldehyde/tree/tree-utils.tsx +170 -170
- package/src/aldehyde/units/EncryptUtils.js +37 -37
- package/src/aldehyde/units/image.d.ts +7 -7
- package/src/aldehyde/units/index.tsx +978 -978
- package/src/aldehyde/units/storage.js +2 -2
- package/src/aldehyde/utils/dsu.ts +27 -27
- package/src/aldehyde/welcome/HCWelcome.js +321 -321
- package/src/aldehyde/welcome/HCWelcome1.js +259 -259
- package/src/aldehyde/welcome/index.css +13 -13
- package/src/aldehyde/welcome/quick-entrance.tsx +98 -98
- package/src/aldehyde/welcome/workbench.tsx +100 -100
- package/lib/controls/action/index.css +0 -9
- package/lib/controls/action/index.d.ts +0 -67
- package/lib/controls/action/index.d.ts.map +0 -1
- package/lib/controls/action/index.js +0 -243
- package/lib/controls/action/index.js.map +0 -1
- package/lib/controls/action/utils.d.ts +0 -15
- package/lib/controls/action/utils.d.ts.map +0 -1
- package/lib/controls/action/utils.js +0 -262
- package/lib/controls/action/utils.js.map +0 -1
- package/lib/controls/auto-complete/index.d.ts +0 -7
- package/lib/controls/auto-complete/index.d.ts.map +0 -1
- package/lib/controls/auto-complete/index.js +0 -58
- package/lib/controls/auto-complete/index.js.map +0 -1
- package/lib/controls/cascader/index.d.ts +0 -23
- package/lib/controls/cascader/index.d.ts.map +0 -1
- package/lib/controls/cascader/index.js +0 -108
- package/lib/controls/cascader/index.js.map +0 -1
- package/lib/controls/chemstruc/graph.d.ts +0 -40
- package/lib/controls/chemstruc/graph.d.ts.map +0 -1
- package/lib/controls/chemstruc/graph.js +0 -133
- package/lib/controls/chemstruc/graph.js.map +0 -1
- package/lib/controls/chemstruc/index.css +0 -28
- package/lib/controls/code-editor/sql-code-editor.d.ts +0 -15
- package/lib/controls/code-editor/sql-code-editor.d.ts.map +0 -1
- package/lib/controls/code-editor/sql-code-editor.js +0 -53
- package/lib/controls/code-editor/sql-code-editor.js.map +0 -1
- package/lib/controls/collapse-card/index.css +0 -9
- package/lib/controls/collapse-card/index.d.ts +0 -33
- package/lib/controls/collapse-card/index.d.ts.map +0 -1
- package/lib/controls/collapse-card/index.js +0 -74
- package/lib/controls/collapse-card/index.js.map +0 -1
- package/lib/controls/color-picker/index.css +0 -27
- package/lib/controls/color-picker/index.d.ts +0 -30
- package/lib/controls/color-picker/index.d.ts.map +0 -1
- package/lib/controls/color-picker/index.js +0 -64
- package/lib/controls/color-picker/index.js.map +0 -1
- package/lib/controls/counting-tag/index.d.ts +0 -20
- package/lib/controls/counting-tag/index.d.ts.map +0 -1
- package/lib/controls/counting-tag/index.js +0 -37
- package/lib/controls/counting-tag/index.js.map +0 -1
- package/lib/controls/cquery/cquick-button.d.ts +0 -36
- package/lib/controls/cquery/cquick-button.d.ts.map +0 -1
- package/lib/controls/cquery/cquick-button.js +0 -75
- package/lib/controls/cquery/cquick-button.js.map +0 -1
- package/lib/controls/date-picker/index.d.ts +0 -7
- package/lib/controls/date-picker/index.d.ts.map +0 -1
- package/lib/controls/date-picker/index.js +0 -91
- package/lib/controls/date-picker/index.js.map +0 -1
- package/lib/controls/entity-select/entity-select.d.ts +0 -87
- package/lib/controls/entity-select/entity-select.d.ts.map +0 -1
- package/lib/controls/entity-select/entity-select.js +0 -475
- package/lib/controls/entity-select/entity-select.js.map +0 -1
- package/lib/controls/entity-select/index.css +0 -6
- package/lib/controls/entity-select/lab-tree-select.d.ts +0 -36
- package/lib/controls/entity-select/lab-tree-select.d.ts.map +0 -1
- package/lib/controls/entity-select/lab-tree-select.js +0 -127
- package/lib/controls/entity-select/lab-tree-select.js.map +0 -1
- package/lib/controls/entity-select/popover-entity-select.d.ts +0 -33
- package/lib/controls/entity-select/popover-entity-select.d.ts.map +0 -1
- package/lib/controls/entity-select/popover-entity-select.js +0 -114
- package/lib/controls/entity-select/popover-entity-select.js.map +0 -1
- package/lib/controls/enum-badge/index.d.ts +0 -7
- package/lib/controls/enum-badge/index.d.ts.map +0 -1
- package/lib/controls/enum-badge/index.js +0 -14
- package/lib/controls/enum-badge/index.js.map +0 -1
- package/lib/controls/enum-tag/index.d.ts +0 -7
- package/lib/controls/enum-tag/index.d.ts.map +0 -1
- package/lib/controls/enum-tag/index.js +0 -27
- package/lib/controls/enum-tag/index.js.map +0 -1
- package/lib/controls/field-history/index.d.ts +0 -8
- package/lib/controls/field-history/index.d.ts.map +0 -1
- package/lib/controls/field-history/index.js +0 -67
- package/lib/controls/field-history/index.js.map +0 -1
- package/lib/controls/file-export/select-code-export.d.ts +0 -13
- package/lib/controls/file-export/select-code-export.d.ts.map +0 -1
- package/lib/controls/file-export/select-code-export.js +0 -14
- package/lib/controls/file-export/select-code-export.js.map +0 -1
- package/lib/controls/file-view/drawer-file-view.d.ts +0 -23
- package/lib/controls/file-view/drawer-file-view.d.ts.map +0 -1
- package/lib/controls/file-view/drawer-file-view.js +0 -49
- package/lib/controls/file-view/drawer-file-view.js.map +0 -1
- package/lib/controls/file-view/index.d.ts +0 -30
- package/lib/controls/file-view/index.d.ts.map +0 -1
- package/lib/controls/file-view/index.js +0 -122
- package/lib/controls/file-view/index.js.map +0 -1
- package/lib/controls/file-view/newin-file-view.d.ts +0 -18
- package/lib/controls/file-view/newin-file-view.d.ts.map +0 -1
- package/lib/controls/file-view/newin-file-view.js +0 -28
- package/lib/controls/file-view/newin-file-view.js.map +0 -1
- package/lib/controls/html-editor/draft.d.ts +0 -22
- package/lib/controls/html-editor/draft.d.ts.map +0 -1
- package/lib/controls/html-editor/draft.js +0 -122
- package/lib/controls/html-editor/draft.js.map +0 -1
- package/lib/controls/html-editor/tinymce.d.ts +0 -13
- package/lib/controls/html-editor/tinymce.d.ts.map +0 -1
- package/lib/controls/html-editor/tinymce.js +0 -47
- package/lib/controls/html-editor/tinymce.js.map +0 -1
- package/lib/controls/input-number/index.d.ts +0 -7
- package/lib/controls/input-number/index.d.ts.map +0 -1
- package/lib/controls/input-number/index.js +0 -77
- package/lib/controls/input-number/index.js.map +0 -1
- package/lib/controls/input-range/index.d.ts +0 -7
- package/lib/controls/input-range/index.d.ts.map +0 -1
- package/lib/controls/input-range/index.js +0 -29
- package/lib/controls/input-range/index.js.map +0 -1
- package/lib/controls/password-setter/index.css +0 -3
- package/lib/controls/password-setter/index.d.ts +0 -17
- package/lib/controls/password-setter/index.d.ts.map +0 -1
- package/lib/controls/password-setter/index.js +0 -59
- package/lib/controls/password-setter/index.js.map +0 -1
- package/lib/controls/progress/index.d.ts +0 -7
- package/lib/controls/progress/index.d.ts.map +0 -1
- package/lib/controls/progress/index.js +0 -52
- package/lib/controls/progress/index.js.map +0 -1
- package/lib/controls/relation-existion/index.css +0 -4
- package/lib/controls/relation-existion/index.d.ts +0 -31
- package/lib/controls/relation-existion/index.d.ts.map +0 -1
- package/lib/controls/relation-existion/index.js +0 -87
- package/lib/controls/relation-existion/index.js.map +0 -1
- package/lib/controls/rfield/index.css +0 -4
- package/lib/controls/rfield/index.d.ts +0 -41
- package/lib/controls/rfield/index.d.ts.map +0 -1
- package/lib/controls/rfield/index.js +0 -149
- package/lib/controls/rfield/index.js.map +0 -1
- package/lib/controls/select/index.d.ts +0 -30
- package/lib/controls/select/index.d.ts.map +0 -1
- package/lib/controls/select/index.js +0 -145
- package/lib/controls/select/index.js.map +0 -1
- package/lib/controls/signature/index.d.ts +0 -42
- package/lib/controls/signature/index.d.ts.map +0 -1
- package/lib/controls/signature/index.js +0 -155
- package/lib/controls/signature/index.js.map +0 -1
- package/lib/controls/steps/index.d.ts +0 -8
- package/lib/controls/steps/index.d.ts.map +0 -1
- package/lib/controls/steps/index.js +0 -47
- package/lib/controls/steps/index.js.map +0 -1
- package/lib/controls/text/ellipsis-text.d.ts +0 -31
- package/lib/controls/text/ellipsis-text.d.ts.map +0 -1
- package/lib/controls/text/ellipsis-text.js +0 -48
- package/lib/controls/text/ellipsis-text.js.map +0 -1
- package/lib/controls/upload/index.d.ts +0 -26
- package/lib/controls/upload/index.d.ts.map +0 -1
- package/lib/controls/upload/index.js +0 -109
- package/lib/controls/upload/index.js.map +0 -1
- package/lib/detail/button/bottom-submit-button-bar.d.ts +0 -24
- package/lib/detail/button/bottom-submit-button-bar.d.ts.map +0 -1
- package/lib/detail/button/bottom-submit-button-bar.js +0 -38
- package/lib/detail/button/bottom-submit-button-bar.js.map +0 -1
- package/lib/detail/button/cquery-button-bar.d.ts +0 -28
- package/lib/detail/button/cquery-button-bar.d.ts.map +0 -1
- package/lib/detail/button/cquery-button-bar.js +0 -79
- package/lib/detail/button/cquery-button-bar.js.map +0 -1
- package/lib/detail/button/edit-button.d.ts +0 -11
- package/lib/detail/button/edit-button.d.ts.map +0 -1
- package/lib/detail/button/edit-button.js +0 -29
- package/lib/detail/button/edit-button.js.map +0 -1
- package/lib/detail/button/fix-right-submit-button-bar.d.ts +0 -26
- package/lib/detail/button/fix-right-submit-button-bar.d.ts.map +0 -1
- package/lib/detail/button/fix-right-submit-button-bar.js +0 -93
- package/lib/detail/button/fix-right-submit-button-bar.js.map +0 -1
- package/lib/detail/button/index.css +0 -43
- package/lib/detail/button/submit-button-bar.d.ts +0 -22
- package/lib/detail/button/submit-button-bar.d.ts.map +0 -1
- package/lib/detail/button/submit-button-bar.js +0 -22
- package/lib/detail/button/submit-button-bar.js.map +0 -1
- package/lib/detail/button/view-button.d.ts +0 -11
- package/lib/detail/button/view-button.d.ts.map +0 -1
- package/lib/detail/button/view-button.js +0 -28
- package/lib/detail/button/view-button.js.map +0 -1
- package/lib/detail/edit/dtmpl-edit.d.ts +0 -48
- package/lib/detail/edit/dtmpl-edit.d.ts.map +0 -1
- package/lib/detail/edit/dtmpl-edit.js +0 -236
- package/lib/detail/edit/dtmpl-edit.js.map +0 -1
- package/lib/detail/edit/fields-edit-card.d.ts +0 -51
- package/lib/detail/edit/fields-edit-card.d.ts.map +0 -1
- package/lib/detail/edit/fields-edit-card.js +0 -63
- package/lib/detail/edit/fields-edit-card.js.map +0 -1
- package/lib/detail/edit/modal-row-edit.d.ts +0 -43
- package/lib/detail/edit/modal-row-edit.d.ts.map +0 -1
- package/lib/detail/edit/modal-row-edit.js +0 -60
- package/lib/detail/edit/modal-row-edit.js.map +0 -1
- package/lib/detail/edit/post-result/index.d.ts +0 -17
- package/lib/detail/edit/post-result/index.d.ts.map +0 -1
- package/lib/detail/edit/post-result/index.js +0 -33
- package/lib/detail/edit/post-result/index.js.map +0 -1
- package/lib/detail/edit/row-edit-card.d.ts +0 -54
- package/lib/detail/edit/row-edit-card.d.ts.map +0 -1
- package/lib/detail/edit/row-edit-card.js +0 -83
- package/lib/detail/edit/row-edit-card.js.map +0 -1
- package/lib/detail/edit/row-editor.d.ts +0 -33
- package/lib/detail/edit/row-editor.d.ts.map +0 -1
- package/lib/detail/edit/row-editor.js +0 -57
- package/lib/detail/edit/row-editor.js.map +0 -1
- package/lib/detail/rightbar/index.css +0 -35
- package/lib/detail/rightbar/index.d.ts +0 -31
- package/lib/detail/rightbar/index.d.ts.map +0 -1
- package/lib/detail/rightbar/index.js +0 -59
- package/lib/detail/rightbar/index.js.map +0 -1
- package/lib/detail/tooltipbar/index.d.ts +0 -19
- package/lib/detail/tooltipbar/index.d.ts.map +0 -1
- package/lib/detail/tooltipbar/index.js +0 -29
- package/lib/detail/tooltipbar/index.js.map +0 -1
- package/lib/detail/view/act-dtmpl-view.d.ts +0 -64
- package/lib/detail/view/act-dtmpl-view.d.ts.map +0 -1
- package/lib/detail/view/act-dtmpl-view.js +0 -152
- package/lib/detail/view/act-dtmpl-view.js.map +0 -1
- package/lib/detail/view/dtmpl-view.d.ts +0 -43
- package/lib/detail/view/dtmpl-view.d.ts.map +0 -1
- package/lib/detail/view/dtmpl-view.js +0 -164
- package/lib/detail/view/dtmpl-view.js.map +0 -1
- package/lib/detail/view/field-view-group.d.ts +0 -30
- package/lib/detail/view/field-view-group.d.ts.map +0 -1
- package/lib/detail/view/field-view-group.js +0 -45
- package/lib/detail/view/field-view-group.js.map +0 -1
- package/lib/detail/view/modal-dtmpl-view.d.ts +0 -40
- package/lib/detail/view/modal-dtmpl-view.d.ts.map +0 -1
- package/lib/detail/view/modal-dtmpl-view.js +0 -34
- package/lib/detail/view/modal-dtmpl-view.js.map +0 -1
- package/lib/detail/view/snapshot-timeline.d.ts +0 -44
- package/lib/detail/view/snapshot-timeline.d.ts.map +0 -1
- package/lib/detail/view/snapshot-timeline.js +0 -92
- package/lib/detail/view/snapshot-timeline.js.map +0 -1
- package/lib/index.d.ts +0 -51
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -116
- package/lib/index.js.map +0 -1
- package/lib/layout/footer/index.css +0 -6
- package/lib/layout/footer/index.d.ts +0 -7
- package/lib/layout/footer/index.d.ts.map +0 -1
- package/lib/layout/footer/index.js +0 -12
- package/lib/layout/footer/index.js.map +0 -1
- package/lib/layout/header/index.css +0 -122
- package/lib/layout/header/index.d.ts +0 -10
- package/lib/layout/header/index.d.ts.map +0 -1
- package/lib/layout/header/index.js +0 -62
- package/lib/layout/header/index.js.map +0 -1
- package/lib/layout/menu/block.css +0 -7
- package/lib/layout/menu/block.d.ts +0 -33
- package/lib/layout/menu/block.d.ts.map +0 -1
- package/lib/layout/menu/block.js +0 -128
- package/lib/layout/menu/block.js.map +0 -1
- package/lib/layout/menu/l2menu-message-bar.d.ts +0 -28
- package/lib/layout/menu/l2menu-message-bar.d.ts.map +0 -1
- package/lib/layout/menu/l2menu-message-bar.js +0 -114
- package/lib/layout/menu/l2menu-message-bar.js.map +0 -1
- package/lib/layout/menu/l2menu-quick-bar.d.ts +0 -45
- package/lib/layout/menu/l2menu-quick-bar.d.ts.map +0 -1
- package/lib/layout/menu/l2menu-quick-bar.js +0 -108
- package/lib/layout/menu/l2menu-quick-bar.js.map +0 -1
- package/lib/layout/menu/menu-2layers.d.ts +0 -26
- package/lib/layout/menu/menu-2layers.d.ts.map +0 -1
- package/lib/layout/menu/menu-2layers.js +0 -95
- package/lib/layout/menu/menu-2layers.js.map +0 -1
- package/lib/layout/menu/menu-render.d.ts +0 -14
- package/lib/layout/menu/menu-render.d.ts.map +0 -1
- package/lib/layout/menu/menu-render.js +0 -159
- package/lib/layout/menu/menu-render.js.map +0 -1
- package/lib/layout/menu/reset-password.d.ts +0 -38
- package/lib/layout/menu/reset-password.d.ts.map +0 -1
- package/lib/layout/menu/reset-password.js +0 -143
- package/lib/layout/menu/reset-password.js.map +0 -1
- package/lib/layout/menu/user-bar.d.ts +0 -50
- package/lib/layout/menu/user-bar.d.ts.map +0 -1
- package/lib/layout/menu/user-bar.js +0 -161
- package/lib/layout/menu/user-bar.js.map +0 -1
- package/lib/layout/menu/userinfo-bar.d.ts +0 -34
- package/lib/layout/menu/userinfo-bar.d.ts.map +0 -1
- package/lib/layout/menu/userinfo-bar.js +0 -49
- package/lib/layout/menu/userinfo-bar.js.map +0 -1
- package/lib/layout/sidebar/index.css +0 -57
- package/lib/layout/sidebar/index.d.ts +0 -12
- package/lib/layout/sidebar/index.d.ts.map +0 -1
- package/lib/layout/sidebar/index.js +0 -45
- package/lib/layout/sidebar/index.js.map +0 -1
- package/lib/layout/sidebar/logo.png +0 -0
- package/lib/layout2/components/userButton.d.ts +0 -5
- package/lib/layout2/components/userButton.d.ts.map +0 -1
- package/lib/layout2/components/userButton.js +0 -133
- package/lib/layout2/components/userButton.js.map +0 -1
- package/lib/layout2/css/header.css +0 -38
- package/lib/layout2/imgs/home.png +0 -0
- package/lib/layout2/type/layout.type.d.ts +0 -10
- package/lib/layout2/type/layout.type.d.ts.map +0 -1
- package/lib/layout2/type/layout.type.js +0 -2
- package/lib/layout2/type/layout.type.js.map +0 -1
- package/lib/layout2/util/menu.util.d.ts +0 -28
- package/lib/layout2/util/menu.util.d.ts.map +0 -1
- package/lib/layout2/util/menu.util.js +0 -85
- package/lib/layout2/util/menu.util.js.map +0 -1
- package/lib/login/vertify/index.css +0 -144
- package/lib/login/vertify/index.d.ts +0 -78
- package/lib/login/vertify/index.d.ts.map +0 -1
- package/lib/login/vertify/index.js +0 -210
- package/lib/login/vertify/index.js.map +0 -1
- package/lib/login/vertify/tool.d.ts +0 -5
- package/lib/login/vertify/tool.d.ts.map +0 -1
- package/lib/login/vertify/tool.js +0 -11
- package/lib/login/vertify/tool.js.map +0 -1
- package/lib/login2/img/login-bg.png +0 -0
- package/lib/table/column/column-selector.d.ts +0 -25
- package/lib/table/column/column-selector.d.ts.map +0 -1
- package/lib/table/column/column-selector.js +0 -62
- package/lib/table/column/column-selector.js.map +0 -1
- package/lib/table/column/index.css +0 -14
- package/lib/table/stat/restat.d.ts +0 -38
- package/lib/table/stat/restat.d.ts.map +0 -1
- package/lib/table/stat/restat.js +0 -62
- package/lib/table/stat/restat.js.map +0 -1
- package/lib/welcome/img/development.png +0 -0
- package/lib/welcome/img/pain-point.png +0 -0
- package/lib/welcome/img/target.png +0 -0
- package/lib/welcome/img/time-cost.png +0 -0
- package/lib/welcome/img/time-prograss.png +0 -0
- package/lib/welcome/img/welcome.png +0 -0
|
@@ -1,204 +1,204 @@
|
|
|
1
|
-
import { ConfigProvider } from "antd";
|
|
2
|
-
import React, { ReactNode, createContext, useEffect, useState } from "react";
|
|
3
|
-
import { useNavigatorLanguage } from "./useLocale";
|
|
4
|
-
import { antdLangMp, getLangWithLangApiMp, getLangWithLangMp } from "./langMp";
|
|
5
|
-
import { LocaleType } from "./langMp";
|
|
6
|
-
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
7
|
-
|
|
8
|
-
export const LocaleContext = createContext<{
|
|
9
|
-
locale: LocaleType;
|
|
10
|
-
langPkg: any;
|
|
11
|
-
availableLang: string[];
|
|
12
|
-
changeLocale: (locale: LocaleType) => void;
|
|
13
|
-
t: (...strs: string[]) => string;
|
|
14
|
-
translate: (...strs: string[]) => string;
|
|
15
|
-
getServiceLangStr?: ()=>string;
|
|
16
|
-
}>({
|
|
17
|
-
locale: undefined,
|
|
18
|
-
availableLang: [],
|
|
19
|
-
langPkg: {},
|
|
20
|
-
changeLocale: () => {},
|
|
21
|
-
t: (...str) => str.join(""),
|
|
22
|
-
translate: (str) => {
|
|
23
|
-
let res = [],
|
|
24
|
-
tres = "";
|
|
25
|
-
|
|
26
|
-
let matchStr = "",
|
|
27
|
-
enableMatch = false;
|
|
28
|
-
|
|
29
|
-
for (const char of str) {
|
|
30
|
-
if (char === "$") {
|
|
31
|
-
enableMatch = true;
|
|
32
|
-
res.push(tres);
|
|
33
|
-
tres = "";
|
|
34
|
-
} else if (enableMatch && char === "{") {
|
|
35
|
-
continue;
|
|
36
|
-
} else if (enableMatch && char === "}") {
|
|
37
|
-
res.push(matchStr);
|
|
38
|
-
enableMatch = false;
|
|
39
|
-
matchStr = "";
|
|
40
|
-
} else if (enableMatch) matchStr += char;
|
|
41
|
-
else tres += char;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
res.push(tres);
|
|
45
|
-
return res.join("");
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const getLocaleWithServer = async (lang: string, serverKey?: string) => {
|
|
50
|
-
const langStr = getLangWithLangApiMp(lang);
|
|
51
|
-
if (langStr === "zh") return;
|
|
52
|
-
|
|
53
|
-
const { value, status } = await HcserviceV3.getLocale(langStr, serverKey);
|
|
54
|
-
|
|
55
|
-
if (status === "success") {
|
|
56
|
-
return value;
|
|
57
|
-
}
|
|
58
|
-
return {};
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const LocaleProvider = ({
|
|
62
|
-
serverKey = "",
|
|
63
|
-
children,
|
|
64
|
-
}: {
|
|
65
|
-
serverKey?: string | string[];
|
|
66
|
-
children: ReactNode;
|
|
67
|
-
}) => {
|
|
68
|
-
const { navigatorLanguage } = useNavigatorLanguage();
|
|
69
|
-
const localeStorageLang: LocaleType = window.localStorage.getItem(
|
|
70
|
-
"locale"
|
|
71
|
-
) as LocaleType;
|
|
72
|
-
const localeStorageLangPkg: object = JSON.parse(
|
|
73
|
-
window.localStorage.getItem("langPkg")
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const [locale, setLocale] = useState<LocaleType>(
|
|
77
|
-
localeStorageLang ? localeStorageLang : getLangWithLangMp(navigatorLanguage)
|
|
78
|
-
);
|
|
79
|
-
const [langPkg, setLangPkg] = useState(
|
|
80
|
-
localeStorageLangPkg ? localeStorageLangPkg : {}
|
|
81
|
-
);
|
|
82
|
-
const [availableLang, setAvailableLang] = useState([]);
|
|
83
|
-
|
|
84
|
-
const changeLocale = async (locale: LocaleType) => {
|
|
85
|
-
setLocale(locale);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const getServiceLangStr = () => {
|
|
89
|
-
const langStr = getLangWithLangApiMp(locale);
|
|
90
|
-
return langStr;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const getAllLocale = async (serverKey: string[]) => {
|
|
94
|
-
const newLangPkg = {
|
|
95
|
-
...langPkg,
|
|
96
|
-
};
|
|
97
|
-
for (const key of serverKey) {
|
|
98
|
-
let res;
|
|
99
|
-
if (key === "") {
|
|
100
|
-
res = await getLocaleWithServer(locale);
|
|
101
|
-
} else {
|
|
102
|
-
res = await getLocaleWithServer(locale, key);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (newLangPkg[locale] !== undefined)
|
|
106
|
-
Object.assign(newLangPkg[locale], res);
|
|
107
|
-
else newLangPkg[locale] = res;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
window.localStorage.setItem("locale", locale);
|
|
111
|
-
setLangPkg(newLangPkg);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
useEffect(() => {
|
|
115
|
-
if (!Array.isArray(serverKey)) serverKey = [...new Set(["", serverKey])];
|
|
116
|
-
getAllLocale([...new Set(["", ...serverKey])]);
|
|
117
|
-
// 获取所有可以配置的语言
|
|
118
|
-
HcserviceV3.getAllLang().then((res) => {
|
|
119
|
-
if (res.status === "success") {
|
|
120
|
-
setAvailableLang(
|
|
121
|
-
res.languages ? res.languages.map((i) => getLangWithLangMp(i)) : []
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}, [locale]);
|
|
126
|
-
|
|
127
|
-
useEffect(() => {
|
|
128
|
-
window.localStorage.setItem("langPkg", JSON.stringify(langPkg));
|
|
129
|
-
}, [langPkg]);
|
|
130
|
-
|
|
131
|
-
const t = (...strs: string[]) => {
|
|
132
|
-
if (locale === "zh") return strs.join("");
|
|
133
|
-
|
|
134
|
-
let res = "",
|
|
135
|
-
flag = false;
|
|
136
|
-
|
|
137
|
-
for (const str of strs) {
|
|
138
|
-
const tStr =
|
|
139
|
-
langPkg[locale] === undefined ? undefined : langPkg[locale][str];
|
|
140
|
-
if (tStr === undefined) {
|
|
141
|
-
flag = true;
|
|
142
|
-
break;
|
|
143
|
-
} else {
|
|
144
|
-
res += tStr + " ";
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return flag ? strs.join("") : res.slice(0, res.length - 1);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const translate = (str) => {
|
|
151
|
-
let res = [],
|
|
152
|
-
resMp = [],
|
|
153
|
-
flag = false,
|
|
154
|
-
tres = "";
|
|
155
|
-
|
|
156
|
-
let matchStr = "",
|
|
157
|
-
enableMatch = false;
|
|
158
|
-
|
|
159
|
-
for (const char of str) {
|
|
160
|
-
if (char === "$" && !enableMatch) {
|
|
161
|
-
enableMatch = true;
|
|
162
|
-
if (tres !== "") {
|
|
163
|
-
res.push(tres);
|
|
164
|
-
tres = "";
|
|
165
|
-
resMp.push(false);
|
|
166
|
-
}
|
|
167
|
-
} else if (enableMatch && char === "{") {
|
|
168
|
-
continue;
|
|
169
|
-
} else if (enableMatch && char === "}") {
|
|
170
|
-
const tStr =
|
|
171
|
-
langPkg[locale] === undefined ? undefined : langPkg[locale][matchStr];
|
|
172
|
-
if (tStr === undefined) {
|
|
173
|
-
flag = true;
|
|
174
|
-
}
|
|
175
|
-
res.push(matchStr);
|
|
176
|
-
resMp.push(true);
|
|
177
|
-
enableMatch = false;
|
|
178
|
-
matchStr = "";
|
|
179
|
-
} else if (enableMatch) matchStr += char;
|
|
180
|
-
else tres += char;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (tres !== "") {
|
|
184
|
-
res.push(tres);
|
|
185
|
-
resMp.push(false);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (flag) return res.join("");
|
|
189
|
-
let resStr = "";
|
|
190
|
-
for (let i = 0; i < res.length; i++) {
|
|
191
|
-
if (resMp[i]) resStr += (i !== 0 ? " " : "") + langPkg[locale][res[i]];
|
|
192
|
-
else resStr += res[i];
|
|
193
|
-
}
|
|
194
|
-
return resStr;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
return (
|
|
198
|
-
<LocaleContext.Provider
|
|
199
|
-
value={{ locale, availableLang, langPkg, changeLocale, t, translate ,getServiceLangStr}}
|
|
200
|
-
>
|
|
201
|
-
{children}
|
|
202
|
-
</LocaleContext.Provider>
|
|
203
|
-
);
|
|
204
|
-
};
|
|
1
|
+
import { ConfigProvider } from "antd";
|
|
2
|
+
import React, { ReactNode, createContext, useEffect, useState } from "react";
|
|
3
|
+
import { useNavigatorLanguage } from "./useLocale";
|
|
4
|
+
import { antdLangMp, getLangWithLangApiMp, getLangWithLangMp } from "./langMp";
|
|
5
|
+
import { LocaleType } from "./langMp";
|
|
6
|
+
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
7
|
+
|
|
8
|
+
export const LocaleContext = createContext<{
|
|
9
|
+
locale: LocaleType;
|
|
10
|
+
langPkg: any;
|
|
11
|
+
availableLang: string[];
|
|
12
|
+
changeLocale: (locale: LocaleType) => void;
|
|
13
|
+
t: (...strs: string[]) => string;
|
|
14
|
+
translate: (...strs: string[]) => string;
|
|
15
|
+
getServiceLangStr?: ()=>string;
|
|
16
|
+
}>({
|
|
17
|
+
locale: undefined,
|
|
18
|
+
availableLang: [],
|
|
19
|
+
langPkg: {},
|
|
20
|
+
changeLocale: () => {},
|
|
21
|
+
t: (...str) => str.join(""),
|
|
22
|
+
translate: (str) => {
|
|
23
|
+
let res = [],
|
|
24
|
+
tres = "";
|
|
25
|
+
|
|
26
|
+
let matchStr = "",
|
|
27
|
+
enableMatch = false;
|
|
28
|
+
|
|
29
|
+
for (const char of str) {
|
|
30
|
+
if (char === "$") {
|
|
31
|
+
enableMatch = true;
|
|
32
|
+
res.push(tres);
|
|
33
|
+
tres = "";
|
|
34
|
+
} else if (enableMatch && char === "{") {
|
|
35
|
+
continue;
|
|
36
|
+
} else if (enableMatch && char === "}") {
|
|
37
|
+
res.push(matchStr);
|
|
38
|
+
enableMatch = false;
|
|
39
|
+
matchStr = "";
|
|
40
|
+
} else if (enableMatch) matchStr += char;
|
|
41
|
+
else tres += char;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
res.push(tres);
|
|
45
|
+
return res.join("");
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const getLocaleWithServer = async (lang: string, serverKey?: string) => {
|
|
50
|
+
const langStr = getLangWithLangApiMp(lang);
|
|
51
|
+
if (langStr === "zh") return;
|
|
52
|
+
|
|
53
|
+
const { value, status } = await HcserviceV3.getLocale(langStr, serverKey);
|
|
54
|
+
|
|
55
|
+
if (status === "success") {
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
return {};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const LocaleProvider = ({
|
|
62
|
+
serverKey = "",
|
|
63
|
+
children,
|
|
64
|
+
}: {
|
|
65
|
+
serverKey?: string | string[];
|
|
66
|
+
children: ReactNode;
|
|
67
|
+
}) => {
|
|
68
|
+
const { navigatorLanguage } = useNavigatorLanguage();
|
|
69
|
+
const localeStorageLang: LocaleType = window.localStorage.getItem(
|
|
70
|
+
"locale"
|
|
71
|
+
) as LocaleType;
|
|
72
|
+
const localeStorageLangPkg: object = JSON.parse(
|
|
73
|
+
window.localStorage.getItem("langPkg")
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const [locale, setLocale] = useState<LocaleType>(
|
|
77
|
+
localeStorageLang ? localeStorageLang : getLangWithLangMp(navigatorLanguage)
|
|
78
|
+
);
|
|
79
|
+
const [langPkg, setLangPkg] = useState(
|
|
80
|
+
localeStorageLangPkg ? localeStorageLangPkg : {}
|
|
81
|
+
);
|
|
82
|
+
const [availableLang, setAvailableLang] = useState([]);
|
|
83
|
+
|
|
84
|
+
const changeLocale = async (locale: LocaleType) => {
|
|
85
|
+
setLocale(locale);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const getServiceLangStr = () => {
|
|
89
|
+
const langStr = getLangWithLangApiMp(locale);
|
|
90
|
+
return langStr;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const getAllLocale = async (serverKey: string[]) => {
|
|
94
|
+
const newLangPkg = {
|
|
95
|
+
...langPkg,
|
|
96
|
+
};
|
|
97
|
+
for (const key of serverKey) {
|
|
98
|
+
let res;
|
|
99
|
+
if (key === "") {
|
|
100
|
+
res = await getLocaleWithServer(locale);
|
|
101
|
+
} else {
|
|
102
|
+
res = await getLocaleWithServer(locale, key);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (newLangPkg[locale] !== undefined)
|
|
106
|
+
Object.assign(newLangPkg[locale], res);
|
|
107
|
+
else newLangPkg[locale] = res;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
window.localStorage.setItem("locale", locale);
|
|
111
|
+
setLangPkg(newLangPkg);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (!Array.isArray(serverKey)) serverKey = [...new Set(["", serverKey])];
|
|
116
|
+
getAllLocale([...new Set(["", ...serverKey])]);
|
|
117
|
+
// 获取所有可以配置的语言
|
|
118
|
+
HcserviceV3.getAllLang().then((res) => {
|
|
119
|
+
if (res.status === "success") {
|
|
120
|
+
setAvailableLang(
|
|
121
|
+
res.languages ? res.languages.map((i) => getLangWithLangMp(i)) : []
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}, [locale]);
|
|
126
|
+
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
window.localStorage.setItem("langPkg", JSON.stringify(langPkg));
|
|
129
|
+
}, [langPkg]);
|
|
130
|
+
|
|
131
|
+
const t = (...strs: string[]) => {
|
|
132
|
+
if (locale === "zh") return strs.join("");
|
|
133
|
+
|
|
134
|
+
let res = "",
|
|
135
|
+
flag = false;
|
|
136
|
+
|
|
137
|
+
for (const str of strs) {
|
|
138
|
+
const tStr =
|
|
139
|
+
langPkg[locale] === undefined ? undefined : langPkg[locale][str];
|
|
140
|
+
if (tStr === undefined) {
|
|
141
|
+
flag = true;
|
|
142
|
+
break;
|
|
143
|
+
} else {
|
|
144
|
+
res += tStr + " ";
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return flag ? strs.join("") : res.slice(0, res.length - 1);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const translate = (str) => {
|
|
151
|
+
let res = [],
|
|
152
|
+
resMp = [],
|
|
153
|
+
flag = false,
|
|
154
|
+
tres = "";
|
|
155
|
+
|
|
156
|
+
let matchStr = "",
|
|
157
|
+
enableMatch = false;
|
|
158
|
+
|
|
159
|
+
for (const char of str) {
|
|
160
|
+
if (char === "$" && !enableMatch) {
|
|
161
|
+
enableMatch = true;
|
|
162
|
+
if (tres !== "") {
|
|
163
|
+
res.push(tres);
|
|
164
|
+
tres = "";
|
|
165
|
+
resMp.push(false);
|
|
166
|
+
}
|
|
167
|
+
} else if (enableMatch && char === "{") {
|
|
168
|
+
continue;
|
|
169
|
+
} else if (enableMatch && char === "}") {
|
|
170
|
+
const tStr =
|
|
171
|
+
langPkg[locale] === undefined ? undefined : langPkg[locale][matchStr];
|
|
172
|
+
if (tStr === undefined) {
|
|
173
|
+
flag = true;
|
|
174
|
+
}
|
|
175
|
+
res.push(matchStr);
|
|
176
|
+
resMp.push(true);
|
|
177
|
+
enableMatch = false;
|
|
178
|
+
matchStr = "";
|
|
179
|
+
} else if (enableMatch) matchStr += char;
|
|
180
|
+
else tres += char;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (tres !== "") {
|
|
184
|
+
res.push(tres);
|
|
185
|
+
resMp.push(false);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (flag) return res.join("");
|
|
189
|
+
let resStr = "";
|
|
190
|
+
for (let i = 0; i < res.length; i++) {
|
|
191
|
+
if (resMp[i]) resStr += (i !== 0 ? " " : "") + langPkg[locale][res[i]];
|
|
192
|
+
else resStr += res[i];
|
|
193
|
+
}
|
|
194
|
+
return resStr;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<LocaleContext.Provider
|
|
199
|
+
value={{ locale, availableLang, langPkg, changeLocale, t, translate ,getServiceLangStr}}
|
|
200
|
+
>
|
|
201
|
+
{children}
|
|
202
|
+
</LocaleContext.Provider>
|
|
203
|
+
);
|
|
204
|
+
};
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import frFr from "antd/locale/fr_FR";
|
|
2
|
-
import zhCN from "antd/locale/zh_CN";
|
|
3
|
-
import enUS from "antd/locale/en_US";
|
|
4
|
-
import ptPT from 'antd/locale/pt_PT';
|
|
5
|
-
import ruRU from 'antd/locale/ru_RU';
|
|
6
|
-
|
|
7
|
-
export type LocaleType = "zh" | "en" | "fr" | "pt" | "ru";
|
|
8
|
-
|
|
9
|
-
export const langMp = {
|
|
10
|
-
fr: ["fra", "fr-FR"],
|
|
11
|
-
zh: ["zh", "zh-CN"],
|
|
12
|
-
en: ["en"],
|
|
13
|
-
pt: ["pt"],
|
|
14
|
-
ru: ["ru"],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const langApiMp = {
|
|
18
|
-
fra: ["fr", "fr-FR"],
|
|
19
|
-
zh: ["zh", "zh-CN"],
|
|
20
|
-
en: ["en"],
|
|
21
|
-
pt: ["pt"],
|
|
22
|
-
ru: ["ru"],
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const getLangWithLangMp: (lang: any) => LocaleType = (lang) => {
|
|
26
|
-
for (const [key, value] of Object.entries(langMp)) {
|
|
27
|
-
if (value.findIndex((i) => i === lang) > -1) return key as LocaleType;
|
|
28
|
-
}
|
|
29
|
-
return "zh" as LocaleType;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const getLangWithLangApiMp = (lang) => {
|
|
33
|
-
for (const [key, value] of Object.entries(langApiMp)) {
|
|
34
|
-
if (value.findIndex((i) => i === lang) > -1) return key;
|
|
35
|
-
}
|
|
36
|
-
return "zh";
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const antdLangMp = {
|
|
40
|
-
zh: zhCN,
|
|
41
|
-
fr: frFr,
|
|
42
|
-
en: enUS,
|
|
43
|
-
pt: ptPT,
|
|
44
|
-
ru: ruRU
|
|
45
|
-
};
|
|
1
|
+
import frFr from "antd/locale/fr_FR";
|
|
2
|
+
import zhCN from "antd/locale/zh_CN";
|
|
3
|
+
import enUS from "antd/locale/en_US";
|
|
4
|
+
import ptPT from 'antd/locale/pt_PT';
|
|
5
|
+
import ruRU from 'antd/locale/ru_RU';
|
|
6
|
+
|
|
7
|
+
export type LocaleType = "zh" | "en" | "fr" | "pt" | "ru";
|
|
8
|
+
|
|
9
|
+
export const langMp = {
|
|
10
|
+
fr: ["fra", "fr-FR"],
|
|
11
|
+
zh: ["zh", "zh-CN"],
|
|
12
|
+
en: ["en"],
|
|
13
|
+
pt: ["pt"],
|
|
14
|
+
ru: ["ru"],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const langApiMp = {
|
|
18
|
+
fra: ["fr", "fr-FR"],
|
|
19
|
+
zh: ["zh", "zh-CN"],
|
|
20
|
+
en: ["en"],
|
|
21
|
+
pt: ["pt"],
|
|
22
|
+
ru: ["ru"],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const getLangWithLangMp: (lang: any) => LocaleType = (lang) => {
|
|
26
|
+
for (const [key, value] of Object.entries(langMp)) {
|
|
27
|
+
if (value.findIndex((i) => i === lang) > -1) return key as LocaleType;
|
|
28
|
+
}
|
|
29
|
+
return "zh" as LocaleType;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getLangWithLangApiMp = (lang) => {
|
|
33
|
+
for (const [key, value] of Object.entries(langApiMp)) {
|
|
34
|
+
if (value.findIndex((i) => i === lang) > -1) return key;
|
|
35
|
+
}
|
|
36
|
+
return "zh";
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const antdLangMp = {
|
|
40
|
+
zh: zhCN,
|
|
41
|
+
fr: frFr,
|
|
42
|
+
en: enUS,
|
|
43
|
+
pt: ptPT,
|
|
44
|
+
ru: ruRU
|
|
45
|
+
};
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
const noLocaleTranslate = (str) => {
|
|
2
|
-
let res = [],
|
|
3
|
-
tres = "";
|
|
4
|
-
|
|
5
|
-
let matchStr = "",
|
|
6
|
-
enableMatch = false;
|
|
7
|
-
|
|
8
|
-
for (const char of str) {
|
|
9
|
-
if (char === "$" && !enableMatch) {
|
|
10
|
-
enableMatch = true;
|
|
11
|
-
res.push(tres);
|
|
12
|
-
tres = "";
|
|
13
|
-
} else if (enableMatch && char === "{") {
|
|
14
|
-
continue;
|
|
15
|
-
} else if (enableMatch && char === "}") {
|
|
16
|
-
res.push(matchStr);
|
|
17
|
-
enableMatch = false;
|
|
18
|
-
matchStr = "";
|
|
19
|
-
} else if (enableMatch) matchStr += char;
|
|
20
|
-
else tres += char;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
res.push(tres);
|
|
24
|
-
return res.join("");
|
|
25
|
-
};
|
|
26
|
-
const translate = (str) => {
|
|
27
|
-
const locale = window.localStorage.getItem("locale");
|
|
28
|
-
const langPkg = JSON.parse(window.localStorage.getItem("langPkg"));
|
|
29
|
-
|
|
30
|
-
if (!locale || !langPkg) return noLocaleTranslate(str);
|
|
31
|
-
|
|
32
|
-
let res = [],
|
|
33
|
-
resMp = [],
|
|
34
|
-
flag = false,
|
|
35
|
-
tres = "";
|
|
36
|
-
|
|
37
|
-
let matchStr = "",
|
|
38
|
-
enableMatch = false;
|
|
39
|
-
|
|
40
|
-
for (const char of str) {
|
|
41
|
-
if (char === "$" && !enableMatch) {
|
|
42
|
-
enableMatch = true;
|
|
43
|
-
if (tres !== "") {
|
|
44
|
-
res.push(tres);
|
|
45
|
-
tres = "";
|
|
46
|
-
resMp.push(false);
|
|
47
|
-
}
|
|
48
|
-
} else if (enableMatch && char === "{") {
|
|
49
|
-
continue;
|
|
50
|
-
} else if (enableMatch && char === "}") {
|
|
51
|
-
const tStr =
|
|
52
|
-
langPkg[locale] === undefined ? undefined : langPkg[locale][matchStr];
|
|
53
|
-
if (tStr === undefined) {
|
|
54
|
-
flag = true;
|
|
55
|
-
}
|
|
56
|
-
res.push(matchStr);
|
|
57
|
-
resMp.push(true);
|
|
58
|
-
enableMatch = false;
|
|
59
|
-
matchStr = "";
|
|
60
|
-
} else if (enableMatch) matchStr += char;
|
|
61
|
-
else tres += char;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (tres !== "") {
|
|
65
|
-
res.push(tres);
|
|
66
|
-
resMp.push(false);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (flag) return res.join("");
|
|
70
|
-
|
|
71
|
-
let resStr = "";
|
|
72
|
-
for (let i = 0; i < res.length; i++) {
|
|
73
|
-
if (resMp[i]) resStr += (i !== 0 ? " " : "") + langPkg[locale][res[i]];
|
|
74
|
-
else resStr += res[i];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return resStr;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export default translate;
|
|
1
|
+
const noLocaleTranslate = (str) => {
|
|
2
|
+
let res = [],
|
|
3
|
+
tres = "";
|
|
4
|
+
|
|
5
|
+
let matchStr = "",
|
|
6
|
+
enableMatch = false;
|
|
7
|
+
|
|
8
|
+
for (const char of str) {
|
|
9
|
+
if (char === "$" && !enableMatch) {
|
|
10
|
+
enableMatch = true;
|
|
11
|
+
res.push(tres);
|
|
12
|
+
tres = "";
|
|
13
|
+
} else if (enableMatch && char === "{") {
|
|
14
|
+
continue;
|
|
15
|
+
} else if (enableMatch && char === "}") {
|
|
16
|
+
res.push(matchStr);
|
|
17
|
+
enableMatch = false;
|
|
18
|
+
matchStr = "";
|
|
19
|
+
} else if (enableMatch) matchStr += char;
|
|
20
|
+
else tres += char;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
res.push(tres);
|
|
24
|
+
return res.join("");
|
|
25
|
+
};
|
|
26
|
+
const translate = (str) => {
|
|
27
|
+
const locale = window.localStorage.getItem("locale");
|
|
28
|
+
const langPkg = JSON.parse(window.localStorage.getItem("langPkg"));
|
|
29
|
+
|
|
30
|
+
if (!locale || !langPkg) return noLocaleTranslate(str);
|
|
31
|
+
|
|
32
|
+
let res = [],
|
|
33
|
+
resMp = [],
|
|
34
|
+
flag = false,
|
|
35
|
+
tres = "";
|
|
36
|
+
|
|
37
|
+
let matchStr = "",
|
|
38
|
+
enableMatch = false;
|
|
39
|
+
|
|
40
|
+
for (const char of str) {
|
|
41
|
+
if (char === "$" && !enableMatch) {
|
|
42
|
+
enableMatch = true;
|
|
43
|
+
if (tres !== "") {
|
|
44
|
+
res.push(tres);
|
|
45
|
+
tres = "";
|
|
46
|
+
resMp.push(false);
|
|
47
|
+
}
|
|
48
|
+
} else if (enableMatch && char === "{") {
|
|
49
|
+
continue;
|
|
50
|
+
} else if (enableMatch && char === "}") {
|
|
51
|
+
const tStr =
|
|
52
|
+
langPkg[locale] === undefined ? undefined : langPkg[locale][matchStr];
|
|
53
|
+
if (tStr === undefined) {
|
|
54
|
+
flag = true;
|
|
55
|
+
}
|
|
56
|
+
res.push(matchStr);
|
|
57
|
+
resMp.push(true);
|
|
58
|
+
enableMatch = false;
|
|
59
|
+
matchStr = "";
|
|
60
|
+
} else if (enableMatch) matchStr += char;
|
|
61
|
+
else tres += char;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (tres !== "") {
|
|
65
|
+
res.push(tres);
|
|
66
|
+
resMp.push(false);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (flag) return res.join("");
|
|
70
|
+
|
|
71
|
+
let resStr = "";
|
|
72
|
+
for (let i = 0; i < res.length; i++) {
|
|
73
|
+
if (resMp[i]) resStr += (i !== 0 ? " " : "") + langPkg[locale][res[i]];
|
|
74
|
+
else resStr += res[i];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return resStr;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default translate;
|