@sparkelf/dsh-dataops-managed 0.3.31 → 0.3.33

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/lib/client.js CHANGED
@@ -24,9 +24,42 @@ window.__ModuleLoader__.load({
24
24
  return target;
25
25
  };
26
26
  //#endregion
27
+ let react_jsx_runtime = require("react/jsx-runtime");
27
28
  let react = require("react");
28
29
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
29
- let react_jsx_runtime = require("react/jsx-runtime");
30
+ //#region src/client/ResourceTabIcon.tsx
31
+ /**
32
+ * 「数据资源」tab 的图标。
33
+ *
34
+ * 以**组件函数**形式提供:sidebar 的 tab 图标契约是
35
+ * `typeof descriptor.icon === 'function' ? descriptor.icon(14) : descriptor.icon`,
36
+ * 传函数可以让 sidebar 自己决定尺寸。用 JSX 而不是 createElement,是为了和同仓
37
+ * 其它插件走同一套 React 运行时(跨运行时创建的元素不会被渲染)。
38
+ */
39
+ function ResourceTabIcon({ size = 14 }) {
40
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
41
+ width: size,
42
+ height: size,
43
+ viewBox: "0 0 24 24",
44
+ fill: "none",
45
+ stroke: "currentColor",
46
+ strokeWidth: 1.8,
47
+ strokeLinecap: "round",
48
+ strokeLinejoin: "round",
49
+ "aria-hidden": "true",
50
+ children: [
51
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ellipse", {
52
+ cx: "12",
53
+ cy: "5.5",
54
+ rx: "7.5",
55
+ ry: "3"
56
+ }),
57
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4.5 5.5v6c0 1.7 3.4 3 7.5 3s7.5-1.3 7.5-3v-6" }),
58
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4.5 11.5v6c0 1.7 3.4 3 7.5 3s7.5-1.3 7.5-3v-6" })
59
+ ]
60
+ });
61
+ }
62
+ //#endregion
30
63
  //#region src/client/brand-store.ts
31
64
  /** Stable local preference key shared by Settings and brand-slot registration. */
32
65
  const WANXIANG_BRAND_PREFERENCE_KEY = "dsh.dataops.wanxiangBrand";
@@ -464,6 +497,15 @@ window.__ModuleLoader__.load({
464
497
  }]
465
498
  }],
466
499
  resources: [
500
+ {
501
+ kind: "builtin",
502
+ id: 1,
503
+ name: "Word 技能",
504
+ ownerName: "平台内置",
505
+ departmentCode: null,
506
+ visibility: "unshared",
507
+ reviewStatus: "unshared"
508
+ },
467
509
  {
468
510
  kind: "skill",
469
511
  id: 9101,
@@ -747,22 +789,22 @@ window.__ModuleLoader__.load({
747
789
  document.head.appendChild(tag);
748
790
  }
749
791
  var ManagedDataOpsSection_module_css_default = {
750
- "status": "_2dqzjG_status",
751
- "row": "_2dqzjG_row",
752
- "meta": "_2dqzjG_meta",
792
+ "label": "_2dqzjG_label",
753
793
  "section": "_2dqzjG_section",
794
+ "card": "_2dqzjG_card",
795
+ "refusal": "_2dqzjG_refusal",
796
+ "row": "_2dqzjG_row",
754
797
  "copy": "_2dqzjG_copy",
798
+ "status": "_2dqzjG_status",
799
+ "meta": "_2dqzjG_meta",
800
+ "reviewActions": "_2dqzjG_reviewActions",
801
+ "title": "_2dqzjG_title",
755
802
  "fields": "_2dqzjG_fields",
756
- "heading": "_2dqzjG_heading",
757
- "label": "_2dqzjG_label",
758
- "reviewHint": "_2dqzjG_reviewHint",
759
803
  "reviewRows": "_2dqzjG_reviewRows",
760
- "title": "_2dqzjG_title",
761
804
  "actions": "_2dqzjG_actions",
762
- "refusal": "_2dqzjG_refusal",
805
+ "reviewHint": "_2dqzjG_reviewHint",
763
806
  "reviewRow": "_2dqzjG_reviewRow",
764
- "reviewActions": "_2dqzjG_reviewActions",
765
- "card": "_2dqzjG_card"
807
+ "heading": "_2dqzjG_heading"
766
808
  };
767
809
  //#endregion
768
810
  //#region src/client/ReviewSettingsCard.tsx
@@ -1309,6 +1351,32 @@ window.__ModuleLoader__.load({
1309
1351
  function normalizeVisibility(value) {
1310
1352
  return value === "department" || value === "private" ? value : "global";
1311
1353
  }
1354
+ /**
1355
+ * Whether this actor may edit one resource-scope row.
1356
+ *
1357
+ * Mirrors the backend policy: built-in skills are super-administrator only, global skills
1358
+ * belong to administrators, and a department administrator edits department rows in their
1359
+ * subtree (the list itself is already narrowed to that subtree).
1360
+ * @param subject - the row's kind and current scope.
1361
+ * @param actorRole - the caller's portal role.
1362
+ * @returns the decision and, when denied, the reason shown on the disabled control.
1363
+ */
1364
+ function canEditResourceScopeRow(subject, actorRole) {
1365
+ if (subject.kind === "builtin") return actorRole === "SUPER_ADMIN" ? { allowed: true } : {
1366
+ allowed: false,
1367
+ reason: "只有超级管理员可以修改内置技能的可见范围。"
1368
+ };
1369
+ if (actorRole === "SUPER_ADMIN" || actorRole === "ADMIN") return { allowed: true };
1370
+ if (actorRole !== "DEPT_ADMIN") return {
1371
+ allowed: false,
1372
+ reason: "没有修改资源范围的权限。"
1373
+ };
1374
+ if (subject.visibility !== "department" || subject.departmentCode === null || subject.departmentCode === void 0) return {
1375
+ allowed: false,
1376
+ reason: "部门管理员只能修改本部门的技能。"
1377
+ };
1378
+ return { allowed: true };
1379
+ }
1312
1380
  /** Whether the caller may see and act on the review queue. */
1313
1381
  function canReview(context) {
1314
1382
  if (context === null || context === void 0) return false;
@@ -1617,24 +1685,24 @@ window.__ModuleLoader__.load({
1617
1685
  document.head.appendChild(tag);
1618
1686
  }
1619
1687
  var NotificationBell_module_css_default = {
1620
- "rowMeta": "tE0trG_rowMeta",
1621
- "bell": "tE0trG_bell",
1622
- "badge": "tE0trG_badge",
1688
+ "empty": "tE0trG_empty",
1689
+ "dot": "tE0trG_dot",
1690
+ "demo": "tE0trG_demo",
1623
1691
  "linkButton": "tE0trG_linkButton",
1692
+ "badge": "tE0trG_badge",
1693
+ "dialog": "tE0trG_dialog",
1624
1694
  "rowTitle": "tE0trG_rowTitle",
1625
- "pager": "tE0trG_pager",
1695
+ "rowTime": "tE0trG_rowTime",
1696
+ "rowMeta": "tE0trG_rowMeta",
1697
+ "button": "tE0trG_button",
1626
1698
  "rowText": "tE0trG_rowText",
1627
1699
  "list": "tE0trG_list",
1628
- "rowBody": "tE0trG_rowBody",
1629
- "button": "tE0trG_button",
1630
- "dot": "tE0trG_dot",
1631
- "rowIcon": "tE0trG_rowIcon",
1632
- "actions": "tE0trG_actions",
1633
- "demo": "tE0trG_demo",
1634
- "empty": "tE0trG_empty",
1635
- "dialog": "tE0trG_dialog",
1700
+ "bell": "tE0trG_bell",
1636
1701
  "row": "tE0trG_row",
1637
- "rowTime": "tE0trG_rowTime"
1702
+ "actions": "tE0trG_actions",
1703
+ "rowBody": "tE0trG_rowBody",
1704
+ "pager": "tE0trG_pager",
1705
+ "rowIcon": "tE0trG_rowIcon"
1638
1706
  };
1639
1707
  //#endregion
1640
1708
  //#region src/client/NotificationBell.tsx
@@ -1925,62 +1993,62 @@ window.__ModuleLoader__.load({
1925
1993
  document.head.appendChild(tag);
1926
1994
  }
1927
1995
  var SkillPlazaSection_module_css_default = {
1928
- "detailLabel": "_9FdZvq_detailLabel",
1929
- "tabActive": "_9FdZvq_tabActive",
1930
- "tagTop": "_9FdZvq_tagTop",
1931
- "auditFooter": "_9FdZvq_auditFooter",
1996
+ "mine": "_9FdZvq_mine",
1997
+ "riskHead": "_9FdZvq_riskHead",
1932
1998
  "severity": "_9FdZvq_severity",
1933
- "finding": "_9FdZvq_finding",
1999
+ "demoTag": "_9FdZvq_demoTag",
2000
+ "findings": "_9FdZvq_findings",
1934
2001
  "findingText": "_9FdZvq_findingText",
1935
2002
  "audit": "_9FdZvq_audit",
1936
- "riskHead": "_9FdZvq_riskHead",
2003
+ "cardTop": "_9FdZvq_cardTop",
2004
+ "detailButton": "_9FdZvq_detailButton",
2005
+ "risk": "_9FdZvq_risk",
1937
2006
  "findingHint": "_9FdZvq_findingHint",
1938
- "riskFailed": "_9FdZvq_riskFailed",
1939
- "rejectedTag": "_9FdZvq_rejectedTag",
2007
+ "noteField": "_9FdZvq_noteField",
1940
2008
  "reviewError": "_9FdZvq_reviewError",
1941
- "findings": "_9FdZvq_findings",
1942
- "mine": "_9FdZvq_mine",
2009
+ "cardDesc": "_9FdZvq_cardDesc",
2010
+ "tabActive": "_9FdZvq_tabActive",
2011
+ "tab": "_9FdZvq_tab",
2012
+ "cardMarks": "_9FdZvq_cardMarks",
2013
+ "tagTop": "_9FdZvq_tagTop",
2014
+ "title": "_9FdZvq_title",
2015
+ "detailLabel": "_9FdZvq_detailLabel",
2016
+ "detailRow": "_9FdZvq_detailRow",
2017
+ "departmentSelect": "_9FdZvq_departmentSelect",
2018
+ "detailValue": "_9FdZvq_detailValue",
2019
+ "reviewButton": "_9FdZvq_reviewButton",
2020
+ "head": "_9FdZvq_head",
2021
+ "riskScore": "_9FdZvq_riskScore",
2022
+ "riskFailed": "_9FdZvq_riskFailed",
2023
+ "cardIcon": "_9FdZvq_cardIcon",
2024
+ "empty": "_9FdZvq_empty",
2025
+ "titleCount": "_9FdZvq_titleCount",
2026
+ "finding": "_9FdZvq_finding",
1943
2027
  "reviewNote": "_9FdZvq_reviewNote",
1944
- "dialog": "_9FdZvq_dialog",
1945
- "auditDialog": "_9FdZvq_auditDialog",
1946
2028
  "notice": "_9FdZvq_notice",
2029
+ "tabs": "_9FdZvq_tabs",
1947
2030
  "emptyIcon": "_9FdZvq_emptyIcon",
1948
- "demoTag": "_9FdZvq_demoTag",
1949
- "risk": "_9FdZvq_risk",
1950
- "noteField": "_9FdZvq_noteField",
1951
- "card": "_9FdZvq_card",
1952
- "empty": "_9FdZvq_empty",
1953
- "cardTop": "_9FdZvq_cardTop",
1954
- "title": "_9FdZvq_title",
2031
+ "rejectedTag": "_9FdZvq_rejectedTag",
2032
+ "section": "_9FdZvq_section",
2033
+ "auditFooter": "_9FdZvq_auditFooter",
2034
+ "departmentLabel": "_9FdZvq_departmentLabel",
1955
2035
  "departmentBar": "_9FdZvq_departmentBar",
1956
- "tabs": "_9FdZvq_tabs",
1957
- "status": "_9FdZvq_status",
1958
- "detailButton": "_9FdZvq_detailButton",
1959
- "departmentSelect": "_9FdZvq_departmentSelect",
1960
- "cards": "_9FdZvq_cards",
1961
- "titleCount": "_9FdZvq_titleCount",
1962
- "cardIcon": "_9FdZvq_cardIcon",
2036
+ "sharedTag": "_9FdZvq_sharedTag",
1963
2037
  "detail": "_9FdZvq_detail",
1964
- "cardEnd": "_9FdZvq_cardEnd",
1965
2038
  "emptyText": "_9FdZvq_emptyText",
1966
- "riskEmpty": "_9FdZvq_riskEmpty",
1967
- "riskSummary": "_9FdZvq_riskSummary",
1968
- "head": "_9FdZvq_head",
1969
- "cardMarks": "_9FdZvq_cardMarks",
1970
- "tabCount": "_9FdZvq_tabCount",
1971
- "sharedTag": "_9FdZvq_sharedTag",
2039
+ "dialog": "_9FdZvq_dialog",
2040
+ "auditDialog": "_9FdZvq_auditDialog",
2041
+ "headRow": "_9FdZvq_headRow",
2042
+ "cardEnd": "_9FdZvq_cardEnd",
1972
2043
  "pendingTag": "_9FdZvq_pendingTag",
1973
- "detailRow": "_9FdZvq_detailRow",
1974
2044
  "cardTitle": "_9FdZvq_cardTitle",
1975
- "detailValue": "_9FdZvq_detailValue",
1976
- "mark": "_9FdZvq_mark",
1977
- "section": "_9FdZvq_section",
1978
- "reviewButton": "_9FdZvq_reviewButton",
1979
- "departmentLabel": "_9FdZvq_departmentLabel",
1980
- "cardDesc": "_9FdZvq_cardDesc",
1981
- "riskScore": "_9FdZvq_riskScore",
1982
- "headRow": "_9FdZvq_headRow",
1983
- "tab": "_9FdZvq_tab"
2045
+ "riskEmpty": "_9FdZvq_riskEmpty",
2046
+ "card": "_9FdZvq_card",
2047
+ "status": "_9FdZvq_status",
2048
+ "tabCount": "_9FdZvq_tabCount",
2049
+ "riskSummary": "_9FdZvq_riskSummary",
2050
+ "cards": "_9FdZvq_cards",
2051
+ "mark": "_9FdZvq_mark"
1984
2052
  };
1985
2053
  //#endregion
1986
2054
  //#region src/client/SkillPlazaSection.tsx
@@ -2646,18 +2714,18 @@ window.__ModuleLoader__.load({
2646
2714
  }
2647
2715
  var WanxiangBrand_module_css_default = {
2648
2716
  "animatedMark": "s0HPxG_animatedMark",
2649
- "unit-right": "s0HPxG_unit-right",
2650
- "unitLeft": "s0HPxG_unitLeft",
2651
- "unit-top": "s0HPxG_unit-top",
2652
- "unitCore": "s0HPxG_unitCore",
2653
- "wordmark": "s0HPxG_wordmark",
2654
- "unit-left": "s0HPxG_unit-left",
2655
- "unitRight": "s0HPxG_unitRight",
2656
2717
  "unit-core": "s0HPxG_unit-core",
2718
+ "unitCore": "s0HPxG_unitCore",
2657
2719
  "harness": "s0HPxG_harness",
2720
+ "wordmark": "s0HPxG_wordmark",
2658
2721
  "unitTop": "s0HPxG_unitTop",
2659
- "sidebarName": "s0HPxG_sidebarName",
2660
- "mark": "s0HPxG_mark"
2722
+ "mark": "s0HPxG_mark",
2723
+ "unit-top": "s0HPxG_unit-top",
2724
+ "unitRight": "s0HPxG_unitRight",
2725
+ "unitLeft": "s0HPxG_unitLeft",
2726
+ "unit-left": "s0HPxG_unit-left",
2727
+ "unit-right": "s0HPxG_unit-right",
2728
+ "sidebarName": "s0HPxG_sidebarName"
2661
2729
  };
2662
2730
  //#endregion
2663
2731
  //#region src/client/WanxiangBrand.tsx
@@ -3074,72 +3142,72 @@ window.__ModuleLoader__.load({
3074
3142
  document.head.appendChild(tag);
3075
3143
  }
3076
3144
  var PermissionCenterSection_module_css_default = {
3077
- "empty": "PNbOqW_empty",
3078
- "muted": "PNbOqW_muted",
3079
- "dialogFooter": "PNbOqW_dialogFooter",
3080
- "permDescription": "PNbOqW_permDescription",
3081
- "rowActions": "PNbOqW_rowActions",
3145
+ "waiting": "PNbOqW_waiting",
3146
+ "field": "PNbOqW_field",
3147
+ "treeName": "PNbOqW_treeName",
3148
+ "deptAdmins": "PNbOqW_deptAdmins",
3082
3149
  "adminTag": "PNbOqW_adminTag",
3083
- "sectionTitle": "PNbOqW_sectionTitle",
3084
- "permCopy": "PNbOqW_permCopy",
3150
+ "rowActions": "PNbOqW_rowActions",
3151
+ "muted": "PNbOqW_muted",
3152
+ "treeChildren": "PNbOqW_treeChildren",
3153
+ "comboboxList": "PNbOqW_comboboxList",
3085
3154
  "combobox": "PNbOqW_combobox",
3086
- "matrix": "PNbOqW_matrix",
3087
- "comboboxEmpty": "PNbOqW_comboboxEmpty",
3088
- "tabs": "PNbOqW_tabs",
3089
- "candidate": "PNbOqW_candidate",
3090
- "department": "PNbOqW_department",
3155
+ "dialog": "PNbOqW_dialog",
3156
+ "comboboxHint": "PNbOqW_comboboxHint",
3091
3157
  "panelHead": "PNbOqW_panelHead",
3158
+ "comboboxTrigger": "PNbOqW_comboboxTrigger",
3092
3159
  "demo": "PNbOqW_demo",
3093
- "tabActive": "PNbOqW_tabActive",
3094
- "notice": "PNbOqW_notice",
3095
- "treeRoot": "PNbOqW_treeRoot",
3096
- "comboboxList": "PNbOqW_comboboxList",
3097
- "detailGrid": "PNbOqW_detailGrid",
3098
- "scopeBadge": "PNbOqW_scopeBadge",
3160
+ "department": "PNbOqW_department",
3161
+ "protected": "PNbOqW_protected",
3099
3162
  "candidates": "PNbOqW_candidates",
3100
- "waiting": "PNbOqW_waiting",
3101
- "table": "PNbOqW_table",
3102
- "panel": "PNbOqW_panel",
3103
- "dialogBody": "PNbOqW_dialogBody",
3104
3163
  "treeToggle": "PNbOqW_treeToggle",
3105
- "comboboxHint": "PNbOqW_comboboxHint",
3106
- "field": "PNbOqW_field",
3107
- "error": "PNbOqW_error",
3108
- "comboboxCheck": "PNbOqW_comboboxCheck",
3164
+ "scopeBadge": "PNbOqW_scopeBadge",
3165
+ "dialogBody": "PNbOqW_dialogBody",
3166
+ "search": "PNbOqW_search",
3167
+ "comboboxEmpty": "PNbOqW_comboboxEmpty",
3168
+ "permission": "PNbOqW_permission",
3109
3169
  "matrixNote": "PNbOqW_matrixNote",
3110
- "page": "PNbOqW_page",
3111
3170
  "treeRow": "PNbOqW_treeRow",
3112
- "treeChildren": "PNbOqW_treeChildren",
3171
+ "candidate": "PNbOqW_candidate",
3172
+ "matrixPermission": "PNbOqW_matrixPermission",
3113
3173
  "dialogHint": "PNbOqW_dialogHint",
3114
- "comboboxPlaceholder": "PNbOqW_comboboxPlaceholder",
3115
- "comboboxTrigger": "PNbOqW_comboboxTrigger",
3174
+ "notice": "PNbOqW_notice",
3175
+ "panel": "PNbOqW_panel",
3176
+ "matrix": "PNbOqW_matrix",
3116
3177
  "matrixScroll": "PNbOqW_matrixScroll",
3117
- "onlyAdmin": "PNbOqW_onlyAdmin",
3118
- "comboboxOption": "PNbOqW_comboboxOption",
3119
- "tab": "PNbOqW_tab",
3120
- "tableScroll": "PNbOqW_tableScroll",
3121
- "departments": "PNbOqW_departments",
3122
- "dialog": "PNbOqW_dialog",
3178
+ "detailGrid": "PNbOqW_detailGrid",
3179
+ "table": "PNbOqW_table",
3180
+ "permDescription": "PNbOqW_permDescription",
3181
+ "permCopy": "PNbOqW_permCopy",
3182
+ "page": "PNbOqW_page",
3123
3183
  "matrixGroup": "PNbOqW_matrixGroup",
3124
- "search": "PNbOqW_search",
3125
- "permission": "PNbOqW_permission",
3126
- "comboboxMenu": "PNbOqW_comboboxMenu",
3127
- "matrixPermission": "PNbOqW_matrixPermission",
3128
- "comboboxOptionActive": "PNbOqW_comboboxOptionActive",
3129
- "deptAdmins": "PNbOqW_deptAdmins",
3130
3184
  "treeActions": "PNbOqW_treeActions",
3131
- "matrixModule": "PNbOqW_matrixModule",
3132
- "protected": "PNbOqW_protected",
3133
- "copied": "PNbOqW_copied",
3134
- "treeName": "PNbOqW_treeName",
3135
- "readOnly": "PNbOqW_readOnly",
3185
+ "onlyAdmin": "PNbOqW_onlyAdmin",
3186
+ "subtitle": "PNbOqW_subtitle",
3187
+ "sectionTitle": "PNbOqW_sectionTitle",
3188
+ "comboboxSearch": "PNbOqW_comboboxSearch",
3189
+ "comboboxCheck": "PNbOqW_comboboxCheck",
3190
+ "tabs": "PNbOqW_tabs",
3191
+ "comboboxOptionActive": "PNbOqW_comboboxOptionActive",
3136
3192
  "pager": "PNbOqW_pager",
3193
+ "departments": "PNbOqW_departments",
3194
+ "empty": "PNbOqW_empty",
3195
+ "tabActive": "PNbOqW_tabActive",
3196
+ "title": "PNbOqW_title",
3197
+ "head": "PNbOqW_head",
3198
+ "readOnly": "PNbOqW_readOnly",
3199
+ "matrixModule": "PNbOqW_matrixModule",
3200
+ "dialogFooter": "PNbOqW_dialogFooter",
3201
+ "tableScroll": "PNbOqW_tableScroll",
3137
3202
  "treeSpacer": "PNbOqW_treeSpacer",
3138
- "comboboxSearch": "PNbOqW_comboboxSearch",
3139
- "subtitle": "PNbOqW_subtitle",
3203
+ "copied": "PNbOqW_copied",
3204
+ "tab": "PNbOqW_tab",
3205
+ "treeRoot": "PNbOqW_treeRoot",
3206
+ "comboboxOption": "PNbOqW_comboboxOption",
3207
+ "error": "PNbOqW_error",
3208
+ "comboboxMenu": "PNbOqW_comboboxMenu",
3140
3209
  "panelFoot": "PNbOqW_panelFoot",
3141
- "head": "PNbOqW_head",
3142
- "title": "PNbOqW_title"
3210
+ "comboboxPlaceholder": "PNbOqW_comboboxPlaceholder"
3143
3211
  };
3144
3212
  //#endregion
3145
3213
  //#region src/client/combobox.ts
@@ -3219,6 +3287,7 @@ window.__ModuleLoader__.load({
3219
3287
  const departmentName = context?.departmentPath?.join(" / ") ?? "—";
3220
3288
  const actorRole = context?.role ?? (knownAdmin ? "ADMIN" : "APP_USER");
3221
3289
  const writable = context === null ? knownAdmin : canManagePermissions(context) || demo;
3290
+ const resourceWritable = writable || actorRole === "DEPT_ADMIN";
3222
3291
  const superAdmin = context === null ? knownAdmin : context.role === "SUPER_ADMIN" || demo;
3223
3292
  const canAssignDepartment = writable && (superAdmin || actorRole === "ADMIN");
3224
3293
  const labels = [
@@ -3435,7 +3504,7 @@ window.__ModuleLoader__.load({
3435
3504
  tab === "resources" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Resources, {
3436
3505
  resources: overview.resources,
3437
3506
  departments: overview.departments,
3438
- writable,
3507
+ writable: resourceWritable,
3439
3508
  actorRole,
3440
3509
  actorDepartmentCode: context?.departmentCode,
3441
3510
  busy,
@@ -4126,8 +4195,9 @@ window.__ModuleLoader__.load({
4126
4195
  visibility: row.visibility,
4127
4196
  departmentCode: row.departmentCode ?? null
4128
4197
  };
4129
- const visibilityLabel = (visibility) => visibility === "global" ? t("permGlobal") : visibility === "department" ? t("permDepartmentScope") : t("permPrivate");
4130
- const statusLabel = (status) => status === "pending" ? t("permStatusPending") : status === "approved" ? t("permStatusApproved") : status === "rejected" ? t("permStatusRejected") : "—";
4198
+ const visibilityLabel = (visibility) => visibility === "global" ? t("permGlobal") : visibility === "department" ? t("permDepartmentScope") : visibility === "unshared" ? t("permUnshared") : t("permPrivate");
4199
+ const typeLabel = (kind) => kind === "builtin" ? t("permResourceBuiltin") : kind === "skill" ? t("permResourceSkill") : t("permResourceWorkflow");
4200
+ const statusLabel = (status) => status === "pending" ? t("permStatusPending") : status === "approved" ? t("permStatusApproved") : status === "rejected" ? t("permStatusRejected") : status === "unshared" ? t("permUnshared") : "—";
4131
4201
  const departmentName = (code) => code === null || code === void 0 ? "—" : departments.find((department) => department.code === code)?.name ?? code;
4132
4202
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4133
4203
  className: PermissionCenterSection_module_css_default.panel,
@@ -4146,13 +4216,19 @@ window.__ModuleLoader__.load({
4146
4216
  ] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: visible.map((row) => {
4147
4217
  const key = keyOf(row);
4148
4218
  const value = valueOf(row);
4149
- const visibilityOptions = actorRole === "DEPT_ADMIN" ? ["department", "private"] : [
4219
+ const edit = canEditResourceScopeRow({
4220
+ kind: row.kind,
4221
+ visibility: row.visibility,
4222
+ departmentCode: row.departmentCode ?? null
4223
+ }, actorRole);
4224
+ const editable = writable && !busy && edit.allowed;
4225
+ const visibilityOptions = row.kind === "builtin" ? actorRole === "SUPER_ADMIN" ? [
4226
+ "unshared",
4150
4227
  "global",
4151
- "department",
4152
- "private"
4153
- ];
4228
+ "department"
4229
+ ] : [row.visibility] : actorRole === "DEPT_ADMIN" ? [row.visibility] : ["global", "department"];
4154
4230
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
4155
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: row.kind === "skill" ? t("permResourceSkill") : t("permResourceWorkflow") }),
4231
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: typeLabel(row.kind) }),
4156
4232
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: row.name }) }),
4157
4233
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: ownerDisplay(row.ownerName) }),
4158
4234
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchCombobox, {
@@ -4160,7 +4236,7 @@ window.__ModuleLoader__.load({
4160
4236
  value: value.visibility,
4161
4237
  ariaLabel: t("permScope"),
4162
4238
  placeholder: t("permSelect"),
4163
- disabled: !writable || busy,
4239
+ disabled: !editable,
4164
4240
  options: visibilityOptions.map((option) => ({
4165
4241
  value: option,
4166
4242
  label: visibilityLabel(option)
@@ -4181,7 +4257,7 @@ window.__ModuleLoader__.load({
4181
4257
  value: value.departmentCode ?? "",
4182
4258
  ariaLabel: t("permDepartment"),
4183
4259
  placeholder: t("permNone"),
4184
- disabled: !writable || busy || value.visibility !== "department" || actorRole === "DEPT_ADMIN",
4260
+ disabled: !editable || value.visibility !== "department" || actorRole === "DEPT_ADMIN",
4185
4261
  options: [{
4186
4262
  value: "",
4187
4263
  label: t("permNone")
@@ -4212,7 +4288,8 @@ window.__ModuleLoader__.load({
4212
4288
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
4213
4289
  variant: "outline",
4214
4290
  size: "sm",
4215
- disabled: !writable || busy,
4291
+ disabled: !editable,
4292
+ title: edit.allowed ? void 0 : edit.reason,
4216
4293
  onClick: () => {
4217
4294
  setError(null);
4218
4295
  if (window.confirm(t("permSave") + "?")) onSave(row, value.visibility, value.departmentCode).then((result) => {
@@ -4258,7 +4335,7 @@ window.__ModuleLoader__.load({
4258
4335
  className: PermissionCenterSection_module_css_default.detailGrid,
4259
4336
  children: [
4260
4337
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("permDetailType") }),
4261
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: detail.kind === "skill" ? t("permResourceSkill") : t("permResourceWorkflow") }),
4338
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: typeLabel(detail.kind) }),
4262
4339
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("permDetailName") }),
4263
4340
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: detail.name }),
4264
4341
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("permDetailOwner") }),
@@ -4568,18 +4645,18 @@ window.__ModuleLoader__.load({
4568
4645
  document.head.appendChild(tag);
4569
4646
  }
4570
4647
  var WorkspaceUpgradePrompt_module_css_default = {
4571
- "sessionPath": "razUfG_sessionPath",
4572
- "dialogText": "razUfG_dialogText",
4573
- "dialogBody": "razUfG_dialogBody",
4574
- "error": "razUfG_error",
4575
4648
  "sessionRow": "razUfG_sessionRow",
4576
- "banner": "razUfG_banner",
4577
4649
  "copy": "razUfG_copy",
4650
+ "sessionTitle": "razUfG_sessionTitle",
4651
+ "title": "razUfG_title",
4652
+ "sessionPath": "razUfG_sessionPath",
4653
+ "error": "razUfG_error",
4578
4654
  "actions": "razUfG_actions",
4655
+ "banner": "razUfG_banner",
4656
+ "dialogBody": "razUfG_dialogBody",
4579
4657
  "sessionList": "razUfG_sessionList",
4580
4658
  "body": "razUfG_body",
4581
- "sessionTitle": "razUfG_sessionTitle",
4582
- "title": "razUfG_title"
4659
+ "dialogText": "razUfG_dialogText"
4583
4660
  };
4584
4661
  //#endregion
4585
4662
  //#region src/client/WorkspaceUpgradePrompt.tsx
@@ -4755,6 +4832,350 @@ window.__ModuleLoader__.load({
4755
4832
  })] });
4756
4833
  }
4757
4834
  //#endregion
4835
+ //#region src/client/ResourceCatalogSidebar.tsx
4836
+ /**
4837
+ * The tab's own data-catalog tree (168px).
4838
+ *
4839
+ * 全部 / 收藏 / 置顶 stay as they were. The catalog section mirrors the portal's folder tree:
4840
+ * multi-root (数据中台 / 交投), expandable folders, counts and a recursive filter. Data comes
4841
+ * from GET /resources/folder-tree through the Host bridge; the right-hand portal iframe only
4842
+ * receives the resulting resource ids, so the portal page itself never renders its own sidebar
4843
+ * in embed mode.
4844
+ *
4845
+ * @module client/ResourceCatalogSidebar
4846
+ */
4847
+ const DOMAIN_LABELS = {
4848
+ "data-platform": "数据中台",
4849
+ jiaotou: "交投"
4850
+ };
4851
+ const CSS = `
4852
+ .dsh-cat{flex:0 0 168px;width:168px;min-width:0;border-right:1px solid var(--dsw-alias-border-l1,#2a2c33);padding:8px 6px;overflow-y:auto;display:flex;flex-direction:column;gap:2px;color:var(--dsw-alias-label-primary,#e6e8ee)}
4853
+ .dsh-cat__head{display:flex;align-items:center;gap:6px;height:34px;padding:0 6px 0 8px;flex:0 0 auto}
4854
+ .dsh-cat__head .ico{width:16px;height:16px;flex:0 0 auto;color:var(--dsw-alias-label-secondary,#aab2c2)}
4855
+ .dsh-cat__head .tt{font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary,#e6e8ee);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
4856
+ .dsh-cat__head .sp{flex:1}
4857
+ .dsh-cat__head .collapse{width:22px;height:22px;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-caption,#8b93a4);cursor:pointer;display:grid;place-items:center}
4858
+ .dsh-cat__head .collapse:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
4859
+ .dsh-cat__search{margin:2px 8px 8px;height:28px;display:flex;align-items:center;gap:6px;padding:0 8px;border-radius:6px;border:1px solid var(--dsw-alias-border-l2,#2c2f38);background:var(--dsw-alias-bg-layer-1,#1a1c21)}
4860
+ .dsh-cat__search input{flex:1;min-width:0;border:0;outline:0;background:transparent;color:var(--dsw-alias-label-primary,#e6e8ee);font-size:12px}
4861
+ .dsh-cat__search input::placeholder{color:var(--dsw-alias-label-caption,#8b93a4)}
4862
+ .dsh-cat__title{margin:8px 6px 3px;font-size:10px;letter-spacing:.04em;color:var(--dsw-alias-label-caption,#8b93a4)}
4863
+ .dsh-cat__item{display:flex;align-items:center;gap:6px;width:100%;height:28px;padding:0 8px;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-secondary,#aab2c2);font-size:12px;text-align:left;cursor:pointer}
4864
+ .dsh-cat__item:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
4865
+ .dsh-cat__item.is-active{background:var(--dsw-alias-interactive-bg-active,rgba(255,255,255,.10));color:var(--dsw-alias-label-primary,#fff)}
4866
+ .dsh-cat__item .n{margin-left:auto;font-size:10px;color:var(--dsw-alias-label-caption,#8b93a4);font-variant-numeric:tabular-nums}
4867
+ .dsh-cat__item .ico{width:14px;text-align:center;font-size:11px;flex:0 0 auto}
4868
+ .dsh-cat__tree{display:flex;flex-direction:column;gap:1px;padding:0 2px 6px}
4869
+ .dsh-cat__node{display:flex;flex-direction:column}
4870
+ .dsh-cat__row{display:flex;align-items:center;gap:5px;width:100%;height:28px;padding:0 6px;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-secondary,#aab2c2);font-size:12px;text-align:left;cursor:pointer}
4871
+ .dsh-cat__row:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
4872
+ .dsh-cat__row.is-active{background:var(--dsw-alias-interactive-bg-active,rgba(255,255,255,.10));color:var(--dsw-alias-label-primary,#fff)}
4873
+ .dsh-cat__tw{width:12px;height:12px;flex:0 0 auto;display:grid;place-items:center;color:var(--dsw-alias-label-caption,#8b93a4);transition:transform .15s ease}
4874
+ .dsh-cat__row.is-open .dsh-cat__tw{transform:rotate(90deg)}
4875
+ .dsh-cat__folder{width:14px;height:14px;flex:0 0 auto;color:var(--dsw-alias-state-business-primary,#5b9dff)}
4876
+ .dsh-cat__row.is-active .dsh-cat__folder{color:inherit}
4877
+ .dsh-cat__nm{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
4878
+ .dsh-cat__cnt{margin-left:auto;font-size:10px;color:var(--dsw-alias-label-caption,#8b93a4);font-variant-numeric:tabular-nums}
4879
+ .dsh-cat__kids{display:none;flex-direction:column;gap:1px;margin-left:13px;padding-left:4px;border-left:1px solid var(--dsw-alias-border-l1,#2a2c33)}
4880
+ .dsh-cat__kids.is-open{display:flex}
4881
+ `;
4882
+ const folderIcon = (open) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
4883
+ className: "dsh-cat__folder",
4884
+ viewBox: "0 0 16 16",
4885
+ fill: "none",
4886
+ stroke: "currentColor",
4887
+ strokeWidth: "1.3",
4888
+ "aria-hidden": "true",
4889
+ children: open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
4890
+ d: "M1.9 5.2h4.2l1.1 1.5h6.9l-1.5 6.1H2.6z",
4891
+ strokeLinejoin: "round"
4892
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
4893
+ d: "M1.9 4.2h4l1.1 1.6h7.1v7.1a1 1 0 0 1-1 1H2.9a1 1 0 0 1-1-1z",
4894
+ strokeLinejoin: "round"
4895
+ })
4896
+ });
4897
+ const normalizeNode = (node) => {
4898
+ const id = Number(node.id);
4899
+ const name = String(node.name ?? node.key ?? id);
4900
+ const children = Array.isArray(node.children) ? node.children.map((child) => normalizeNode(child)) : [];
4901
+ return {
4902
+ id,
4903
+ name,
4904
+ label: String(node.chineseName ?? DOMAIN_LABELS[name] ?? node.name ?? node.key ?? id),
4905
+ count: Number(node.recursiveResourceCount ?? node.resourceCount ?? 0),
4906
+ children
4907
+ };
4908
+ };
4909
+ function ResourceCatalogSidebar({ onFilter }) {
4910
+ const [folders, setFolders] = (0, react.useState)([]);
4911
+ const [total, setTotal] = (0, react.useState)(0);
4912
+ const [favorites, setFavorites] = (0, react.useState)([]);
4913
+ const [pinned, setPinned] = (0, react.useState)([]);
4914
+ const [favoriteTotal, setFavoriteTotal] = (0, react.useState)(0);
4915
+ const [pinnedTotal, setPinnedTotal] = (0, react.useState)(0);
4916
+ const [active, setActive] = (0, react.useState)("all");
4917
+ const [query, setQuery] = (0, react.useState)("");
4918
+ const [openKeys, setOpenKeys] = (0, react.useState)(() => /* @__PURE__ */ new Set());
4919
+ const [expandedOnce, setExpandedOnce] = (0, react.useState)(false);
4920
+ (0, react.useEffect)(() => {
4921
+ const style = document.createElement("style");
4922
+ style.dataset.dataopsCatalogTree = "true";
4923
+ style.textContent = CSS;
4924
+ document.head.appendChild(style);
4925
+ return () => style.remove();
4926
+ }, []);
4927
+ (0, react.useEffect)(() => {
4928
+ let live = true;
4929
+ let timer;
4930
+ const load = async () => {
4931
+ try {
4932
+ const [treeResponse, listResponse, favoriteResponse, pinnedResponse] = await Promise.all([
4933
+ fetch("/integrations/dataops/resources/folder-tree", { headers: { accept: "application/json" } }),
4934
+ fetch("/integrations/dataops/resources?page=1&pageSize=100", { headers: { accept: "application/json" } }),
4935
+ fetch("/integrations/dataops/resources/favorites?page=1&pageSize=100", { headers: { accept: "application/json" } }),
4936
+ fetch("/integrations/dataops/resources/pinned?page=1&pageSize=100", { headers: { accept: "application/json" } })
4937
+ ]);
4938
+ if (!live) return false;
4939
+ if (!treeResponse.ok) throw new Error("HTTP " + String(treeResponse.status));
4940
+ const roots = ((await treeResponse.json()).nodes ?? []).map(normalizeNode);
4941
+ setFolders(roots);
4942
+ if (!expandedOnce) {
4943
+ setOpenKeys(new Set(roots.filter((node) => node.children.length > 0).map((node) => node.id)));
4944
+ setExpandedOnce(true);
4945
+ }
4946
+ if (listResponse.ok) {
4947
+ const list = await listResponse.json();
4948
+ setTotal(typeof list.total === "number" ? list.total : (list.items ?? []).length);
4949
+ }
4950
+ if (favoriteResponse.ok) {
4951
+ const page = await favoriteResponse.json();
4952
+ setFavorites((page.items ?? []).map((item) => item.resourceId ?? item.resource?.id).filter((id) => typeof id === "number"));
4953
+ setFavoriteTotal(typeof page.total === "number" ? page.total : (page.items ?? []).length);
4954
+ }
4955
+ if (pinnedResponse.ok) {
4956
+ const page = await pinnedResponse.json();
4957
+ setPinned((page.items ?? []).map((item) => item.resourceId ?? item.resource?.id).filter((id) => typeof id === "number"));
4958
+ setPinnedTotal(typeof page.total === "number" ? page.total : (page.items ?? []).length);
4959
+ }
4960
+ return true;
4961
+ } catch {
4962
+ return false;
4963
+ }
4964
+ };
4965
+ const run = async () => {
4966
+ const ok = await load();
4967
+ if (!live) return;
4968
+ if (!ok) timer = window.setTimeout(() => {
4969
+ run();
4970
+ }, 2500);
4971
+ };
4972
+ run();
4973
+ return () => {
4974
+ live = false;
4975
+ if (timer !== void 0) window.clearTimeout(timer);
4976
+ };
4977
+ }, [expandedOnce]);
4978
+ const item = (key, icon, label, count) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4979
+ type: "button",
4980
+ className: "dsh-cat__item" + (active === key ? " is-active" : ""),
4981
+ onClick: () => {
4982
+ setActive(key);
4983
+ if (key === "all") onFilter({ scope: "all" });
4984
+ else if (key === "favorites") onFilter({
4985
+ scope: "favorites",
4986
+ ids: favorites
4987
+ });
4988
+ else onFilter({
4989
+ scope: "pinned",
4990
+ ids: pinned
4991
+ });
4992
+ },
4993
+ "data-catalog-key": key,
4994
+ children: [
4995
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4996
+ className: "ico",
4997
+ "aria-hidden": "true",
4998
+ children: icon
4999
+ }),
5000
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5001
+ style: {
5002
+ overflow: "hidden",
5003
+ textOverflow: "ellipsis",
5004
+ whiteSpace: "nowrap"
5005
+ },
5006
+ children: label
5007
+ }),
5008
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5009
+ className: "n",
5010
+ children: count
5011
+ })
5012
+ ]
5013
+ }, key);
5014
+ const selectNode = (0, react.useCallback)(async (node) => {
5015
+ setActive("node:" + String(node.id));
5016
+ setOpenKeys((previous) => new Set(previous).add(node.id));
5017
+ try {
5018
+ const response = await fetch("/integrations/dataops/resources?catalogNodeId=" + String(node.id) + "&page=1&pageSize=100", { headers: { accept: "application/json" } });
5019
+ if (!response.ok) return;
5020
+ const page = await response.json();
5021
+ onFilter({
5022
+ scope: "catalogNode",
5023
+ nodeId: node.id,
5024
+ ids: (page.items ?? []).map((row) => row.id)
5025
+ });
5026
+ } catch {}
5027
+ }, [onFilter]);
5028
+ const matches = (node) => {
5029
+ const q = query.trim().toLowerCase();
5030
+ if (q === "") return true;
5031
+ return node.label.toLowerCase().includes(q) || node.children.some(matches);
5032
+ };
5033
+ const nodeHtml = (node) => {
5034
+ const open = openKeys.has(node.id);
5035
+ const activeNode = active === "node:" + String(node.id);
5036
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5037
+ className: "dsh-cat__node",
5038
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
5039
+ type: "button",
5040
+ className: "dsh-cat__row" + (open ? " is-open" : "") + (activeNode ? " is-active" : ""),
5041
+ onClick: () => {
5042
+ selectNode(node);
5043
+ },
5044
+ title: node.label,
5045
+ "data-catalog-key": "node:" + String(node.id),
5046
+ children: [
5047
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5048
+ className: "dsh-cat__tw",
5049
+ role: node.children.length > 0 ? "button" : void 0,
5050
+ "aria-label": node.children.length > 0 ? open ? "收起目录" : "展开目录" : void 0,
5051
+ onClick: (event) => {
5052
+ if (node.children.length === 0) return;
5053
+ event.stopPropagation();
5054
+ setOpenKeys((previous) => {
5055
+ const next = new Set(previous);
5056
+ if (next.has(node.id)) next.delete(node.id);
5057
+ else next.add(node.id);
5058
+ return next;
5059
+ });
5060
+ },
5061
+ children: node.children.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
5062
+ viewBox: "0 0 16 16",
5063
+ width: "10",
5064
+ height: "10",
5065
+ fill: "none",
5066
+ stroke: "currentColor",
5067
+ strokeWidth: "2.2",
5068
+ strokeLinecap: "round",
5069
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6 3.5 10.5 8 6 12.5" })
5070
+ }) : null
5071
+ }),
5072
+ folderIcon(open),
5073
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5074
+ className: "dsh-cat__nm",
5075
+ children: node.label
5076
+ }),
5077
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5078
+ className: "dsh-cat__cnt",
5079
+ children: node.count
5080
+ })
5081
+ ]
5082
+ }), node.children.length > 0 && matches(node) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5083
+ className: "dsh-cat__kids" + (open ? " is-open" : ""),
5084
+ children: node.children.filter(matches).map(nodeHtml)
5085
+ }) : null]
5086
+ }, node.id);
5087
+ };
5088
+ const visibleFolders = folders.filter(matches);
5089
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("aside", {
5090
+ className: "dsh-cat",
5091
+ "aria-label": "数据目录",
5092
+ children: [
5093
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5094
+ className: "dsh-cat__head",
5095
+ children: [
5096
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
5097
+ className: "ico",
5098
+ viewBox: "0 0 16 16",
5099
+ fill: "none",
5100
+ stroke: "currentColor",
5101
+ strokeWidth: "1.4",
5102
+ "aria-hidden": "true",
5103
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M1.8 4.2h4l1.2 1.6h7.2v7.2a1 1 0 0 1-1 1H2.8a1 1 0 0 1-1-1z" })
5104
+ }),
5105
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5106
+ className: "tt",
5107
+ children: "数据资源"
5108
+ }),
5109
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "sp" }),
5110
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5111
+ className: "collapse",
5112
+ type: "button",
5113
+ "aria-label": "收起目录",
5114
+ title: "收起目录",
5115
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
5116
+ viewBox: "0 0 16 16",
5117
+ width: "13",
5118
+ height: "13",
5119
+ fill: "none",
5120
+ stroke: "currentColor",
5121
+ strokeWidth: "1.4",
5122
+ "aria-hidden": "true",
5123
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
5124
+ x: "1.8",
5125
+ y: "2.8",
5126
+ width: "12.4",
5127
+ height: "10.4",
5128
+ rx: "1.6"
5129
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6 2.8v10.4" })]
5130
+ })
5131
+ })
5132
+ ]
5133
+ }),
5134
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
5135
+ className: "dsh-cat__search",
5136
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
5137
+ viewBox: "0 0 16 16",
5138
+ width: "12",
5139
+ height: "12",
5140
+ fill: "none",
5141
+ stroke: "currentColor",
5142
+ strokeWidth: "1.5",
5143
+ "aria-hidden": "true",
5144
+ style: { opacity: .7 },
5145
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
5146
+ cx: "7",
5147
+ cy: "7",
5148
+ r: "4.2"
5149
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10.2 10.2 13.5 13.5" })]
5150
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
5151
+ value: query,
5152
+ onChange: (event) => setQuery(event.target.value),
5153
+ placeholder: "按目录名搜索…",
5154
+ "aria-label": "按目录名搜索"
5155
+ })]
5156
+ }),
5157
+ item("all", "▤", "全部", total),
5158
+ item("favorites", "★", "收藏", favoriteTotal),
5159
+ item("pinned", "📌", "置顶", pinnedTotal),
5160
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5161
+ className: "dsh-cat__title",
5162
+ children: "数据目录"
5163
+ }),
5164
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5165
+ className: "dsh-cat__tree",
5166
+ children: visibleFolders.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5167
+ style: {
5168
+ padding: "4px 8px",
5169
+ fontSize: 10.5,
5170
+ opacity: .7
5171
+ },
5172
+ children: "暂无目录"
5173
+ }) : visibleFolders.map(nodeHtml)
5174
+ })
5175
+ ]
5176
+ });
5177
+ }
5178
+ //#endregion
4758
5179
  //#region src/client/DataOpsResourcesTab.tsx
4759
5180
  /**
4760
5181
  * The custom `dataops-resources` sidebar tab.
@@ -4778,17 +5199,18 @@ window.__ModuleLoader__.load({
4778
5199
  };
4779
5200
  const buildEmbedUrl = (config, meta) => {
4780
5201
  const base = config.embedBaseUrl.replace(/\/+$/u, "");
4781
- const params = new URLSearchParams();
4782
- if (meta.resourceId !== void 0) params.set("resourceId", String(meta.resourceId));
4783
- if (meta.mode === "detail" || meta.mode === "audit") {
4784
- params.set("tab", meta.mode === "audit" ? "audit" : "overview");
4785
- const suffix = params.toString();
4786
- return `${base}/embed/resource-detail${suffix ? "?" + suffix : ""}`;
5202
+ const hash = config.token === void 0 ? "" : "#accessToken=" + encodeURIComponent(config.token);
5203
+ if (meta.resourceId !== void 0 && (meta.mode === "detail" || meta.mode === "audit")) {
5204
+ const params = new URLSearchParams({
5205
+ assetTab: "resources",
5206
+ prototype: "resource-detail",
5207
+ resourceId: String(meta.resourceId),
5208
+ embed: "1"
5209
+ });
5210
+ if (meta.mode === "audit") params.set("tab", "audit");
5211
+ return `${base}/assets?${params.toString()}${hash}`;
4787
5212
  }
4788
- params.set("mode", meta.mode ?? "focus");
4789
- if (meta.nonce) params.set("nonce", meta.nonce);
4790
- const suffix = params.toString();
4791
- return `${base}/embed/resources${suffix ? "?" + suffix : ""}`;
5213
+ return `${base}/assets?assetTab=resources&embed=1${hash}`;
4792
5214
  };
4793
5215
  const frameStyle = {
4794
5216
  width: "100%",
@@ -4818,6 +5240,7 @@ window.__ModuleLoader__.load({
4818
5240
  const [loading, setLoading] = (0, react.useState)(true);
4819
5241
  const [notice, setNotice] = (0, react.useState)("");
4820
5242
  const [reloadKey, setReloadKey] = (0, react.useState)(0);
5243
+ const [filter, setFilter] = (0, react.useState)({ scope: "all" });
4821
5244
  const iframeRef = (0, react.useRef)(null);
4822
5245
  const meta = readMeta(tab.meta);
4823
5246
  const src = (0, react.useMemo)(() => config === null ? "" : buildEmbedUrl(config, meta), [
@@ -4835,11 +5258,16 @@ window.__ModuleLoader__.load({
4835
5258
  if (!response.ok) throw new Error("HTTP " + response.status.toString());
4836
5259
  const body = await response.json();
4837
5260
  if (!live) return;
4838
- setConfig({
5261
+ const next = {
4839
5262
  embedBaseUrl: body.embedBaseUrl,
4840
5263
  sameOrigin: body.sameOrigin === true,
4841
- tabType: body.tabType
4842
- });
5264
+ tabType: body.tabType,
5265
+ ...typeof body.token === "string" && body.token !== "" ? { token: body.token } : {}
5266
+ };
5267
+ if (next.sameOrigin && next.token !== void 0) try {
5268
+ window.sessionStorage.setItem("dataops_auth_token", next.token);
5269
+ } catch {}
5270
+ setConfig(next);
4843
5271
  } catch (loadError) {
4844
5272
  if (!live) return;
4845
5273
  setError("资源页配置加载失败:" + (loadError instanceof Error ? loadError.message : String(loadError)));
@@ -4862,22 +5290,26 @@ window.__ModuleLoader__.load({
4862
5290
  expectedOrigin = "";
4863
5291
  }
4864
5292
  const onMessage = (event) => {
5293
+ if (event.source !== iframeRef.current?.contentWindow) return;
4865
5294
  if (expectedOrigin && event.origin !== expectedOrigin) return;
4866
5295
  const payload = event.data;
4867
- if (payload?.type !== "dataops:add-to-conversation") return;
4868
- const reference = payload.reference ?? {
5296
+ const legacy = payload?.type === "dataops:add-to-conversation";
5297
+ const embed = payload?.source === "dataops-embed" && payload?.type === "add-to-conversation";
5298
+ if (!legacy && !embed) return;
5299
+ const resource = payload?.resource ?? {};
5300
+ const reference = payload?.reference ?? {
4869
5301
  kind: "dataops-resource",
4870
- resourceId: payload.resource?.id,
4871
- name: payload.resource?.name,
4872
- table: payload.resource?.table
5302
+ resourceId: resource.id,
5303
+ name: resource.name,
5304
+ table: resource.table ?? resource.sourceTable ?? null
4873
5305
  };
4874
5306
  if (insertResourceReference === void 0) {
4875
5307
  setNotice("当前会话不可用,无法插入资源引用");
4876
5308
  return;
4877
5309
  }
4878
5310
  try {
4879
- insertResourceReference(payload.resource ?? {}, reference, scope?.sessionId);
4880
- setNotice("");
5311
+ insertResourceReference(resource, reference, scope?.sessionId);
5312
+ setNotice("已添加到对话");
4881
5313
  } catch (insertError) {
4882
5314
  setNotice("插入引用失败:" + (insertError instanceof Error ? insertError.message : String(insertError)));
4883
5315
  }
@@ -4908,6 +5340,22 @@ window.__ModuleLoader__.load({
4908
5340
  document.head.appendChild(style);
4909
5341
  return () => style.remove();
4910
5342
  }, []);
5343
+ const postFilter = (0, react.useCallback)(() => {
5344
+ const frame = iframeRef.current?.contentWindow;
5345
+ if (!frame) return;
5346
+ const payload = filter.scope === "catalogNode" ? {
5347
+ scope: "favorites",
5348
+ ids: filter.ids ?? []
5349
+ } : filter;
5350
+ frame.postMessage({
5351
+ source: "dsh-host",
5352
+ type: "filter",
5353
+ ...payload
5354
+ }, "*");
5355
+ }, [filter]);
5356
+ (0, react.useEffect)(() => {
5357
+ postFilter();
5358
+ }, [postFilter]);
4911
5359
  (0, react.useEffect)(() => {
4912
5360
  if (!notice) return void 0;
4913
5361
  const timer = window.setTimeout(() => setNotice(""), 2400);
@@ -4933,38 +5381,49 @@ window.__ModuleLoader__.load({
4933
5381
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4934
5382
  style: {
4935
5383
  display: "flex",
4936
- flexDirection: "column",
4937
5384
  height: "100%",
4938
5385
  minHeight: 0
4939
5386
  },
4940
- children: [
4941
- notice ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4942
- style: noticeStyle,
4943
- role: "status",
4944
- children: notice
4945
- }) : null,
4946
- loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4947
- style: stateStyle,
4948
- role: "status",
4949
- children: "正在加载数据资源页…"
4950
- }) : null,
4951
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
4952
- ref: iframeRef,
4953
- src,
4954
- title: meta.resourceName ? `${meta.resourceName} · 数据资源` : "数据资源",
4955
- sandbox: "allow-same-origin allow-scripts allow-forms allow-popups allow-downloads",
4956
- referrerPolicy: "no-referrer",
4957
- style: {
4958
- ...frameStyle,
4959
- display: loading ? "none" : "block"
4960
- },
4961
- onLoad: () => setLoading(false),
4962
- onError: () => {
4963
- setLoading(false);
4964
- setError("数据资源页加载失败");
4965
- }
4966
- }, `${src}:${reloadKey}`)
4967
- ]
5387
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResourceCatalogSidebar, { onFilter: setFilter }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5388
+ style: {
5389
+ flex: 1,
5390
+ minWidth: 0,
5391
+ display: "flex",
5392
+ flexDirection: "column",
5393
+ minHeight: 0
5394
+ },
5395
+ children: [
5396
+ notice ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5397
+ style: noticeStyle,
5398
+ role: "status",
5399
+ children: notice
5400
+ }) : null,
5401
+ loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5402
+ style: stateStyle,
5403
+ role: "status",
5404
+ children: "正在加载数据资源页…"
5405
+ }) : null,
5406
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
5407
+ ref: iframeRef,
5408
+ src,
5409
+ title: meta.resourceName ? `${meta.resourceName} · 数据资源` : "数据资源",
5410
+ sandbox: "allow-same-origin allow-scripts allow-forms allow-popups allow-downloads",
5411
+ referrerPolicy: "no-referrer",
5412
+ style: {
5413
+ ...frameStyle,
5414
+ display: loading ? "none" : "block"
5415
+ },
5416
+ onLoad: () => {
5417
+ setLoading(false);
5418
+ postFilter();
5419
+ },
5420
+ onError: () => {
5421
+ setLoading(false);
5422
+ setError("数据资源页加载失败");
5423
+ }
5424
+ }, `${src}:${reloadKey}`)
5425
+ ]
5426
+ })]
4968
5427
  });
4969
5428
  }
4970
5429
  //#endregion
@@ -5131,6 +5590,8 @@ window.__ModuleLoader__.load({
5131
5590
  permWaiting: "The permission-centre API is waiting for the backend (task-37).",
5132
5591
  permResourceSkill: "Skill",
5133
5592
  permResourceWorkflow: "Workflow",
5593
+ permResourceBuiltin: "Built-in skill",
5594
+ permUnshared: "Not shared",
5134
5595
  permResourceKb: "Knowledge base",
5135
5596
  permType: "Type",
5136
5597
  permName: "Name",
@@ -5278,6 +5739,8 @@ window.__ModuleLoader__.load({
5278
5739
  permWaiting: "权限中心 API 待后端联调(task-37)。",
5279
5740
  permResourceSkill: "技能",
5280
5741
  permResourceWorkflow: "工作流",
5742
+ permResourceBuiltin: "内置技能",
5743
+ permUnshared: "未共享",
5281
5744
  permResourceKb: "知识库",
5282
5745
  permType: "类型",
5283
5746
  permName: "名称",
@@ -5573,6 +6036,7 @@ window.__ModuleLoader__.load({
5573
6036
  disposeTab = service.registerTab({
5574
6037
  id: RESOURCE_TAB_TYPE,
5575
6038
  title: "数据资源",
6039
+ icon: ResourceTabIcon,
5576
6040
  description: "DataOps 全量资源、授权与操作记录",
5577
6041
  order: 60,
5578
6042
  single: true,