@byteluck-fe/model-driven-controls 7.1.0-beta.0 → 7.1.0-beta.2

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": "model-driven.control-catalog.v1",
3
- "packageVersion": "7.1.0-beta.0",
4
- "sourceRevision": "sha256:534ea4fa9365cb588120b907649c06fe7d281c4f37ec27c648d79f12e78f747d",
5
- "revision": "sha256:22b3a3c666b2bc3f29764b26127b57869ab1b41e81f007448281cca1004bc829",
3
+ "packageVersion": "7.1.0-beta.2",
4
+ "sourceRevision": "sha256:4cdee256c5d2cda0cd50a4e95062cbf508b492bf72cedf51d97fed16cc1232ab",
5
+ "revision": "sha256:0298f53a35e5849dc05fdf4277e9945bb627d04325f6f8fca9f1098469c2ad93",
6
6
  "localeMessages": {
7
7
  "CMD.approvedDocuments": {
8
8
  "key": "CMD.approvedDocuments",
@@ -3,6 +3,9 @@ function _array_like_to_array(arr, len) {
3
3
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
4
  return arr2;
5
5
  }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
6
9
  function _array_without_holes(arr) {
7
10
  if (Array.isArray(arr)) return _array_like_to_array(arr);
8
11
  }
@@ -11,9 +14,39 @@ function _iterable_to_array(iter) {
11
14
  return Array.from(iter);
12
15
  }
13
16
  }
17
+ function _iterable_to_array_limit(arr, i) {
18
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
19
+ if (_i == null) return;
20
+ var _arr = [];
21
+ var _n = true;
22
+ var _d = false;
23
+ var _s, _e;
24
+ try {
25
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
26
+ _arr.push(_s.value);
27
+ if (i && _arr.length === i) break;
28
+ }
29
+ } catch (err) {
30
+ _d = true;
31
+ _e = err;
32
+ } finally{
33
+ try {
34
+ if (!_n && _i["return"] != null) _i["return"]();
35
+ } finally{
36
+ if (_d) throw _e;
37
+ }
38
+ }
39
+ return _arr;
40
+ }
41
+ function _non_iterable_rest() {
42
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43
+ }
14
44
  function _non_iterable_spread() {
15
45
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
16
46
  }
47
+ function _sliced_to_array(arr, i) {
48
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
49
+ }
17
50
  function _to_consumable_array(arr) {
18
51
  return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
19
52
  }
@@ -61,6 +94,33 @@ export function getControlSettingFacts(type) {
61
94
  var _definitionsByType_get;
62
95
  return clone(((_definitionsByType_get = definitionsByType.get(type)) === null || _definitionsByType_get === void 0 ? void 0 : _definitionsByType_get.settingFacts) || []);
63
96
  }
97
+ /**
98
+ * 按保存键查询目标控件的实际属性支持事实。
99
+ *
100
+ * propsSchema 可能声明了工厂默认模型未实际物化的可选属性,因此必须同时命中
101
+ * propertyNameMap 与 defaultProps,才能作为控件切换时的能力证据。
102
+ */ export function getControlSavedPropertyFact(type, savedPropertyKey) {
103
+ var definition = definitionsByType.get(type);
104
+ if (!definition) return undefined;
105
+ var propertyEntry = Object.entries(definition.propertyNameMap).find(function(param) {
106
+ var _param = _sliced_to_array(param, 2), savedKey = _param[1];
107
+ return savedKey === savedPropertyKey;
108
+ });
109
+ if (!propertyEntry) return undefined;
110
+ var _propertyEntry = _sliced_to_array(propertyEntry, 1), propertyKey = _propertyEntry[0];
111
+ if (!Object.prototype.hasOwnProperty.call(definition.defaultProps, propertyKey)) {
112
+ return undefined;
113
+ }
114
+ var defaultValue = definition.defaultProps[propertyKey];
115
+ // generated JSON 不允许 undefined;若产物被破坏则窄查询继续失败关闭。
116
+ if (defaultValue === undefined) return undefined;
117
+ return clone({
118
+ controlType: definition.type,
119
+ defaultValue: defaultValue,
120
+ propertyKey: propertyKey,
121
+ savedPropertyKey: savedPropertyKey
122
+ });
123
+ }
64
124
  /** headless 按稳定 key 窄查消息事实,避免复制整份 catalog。 */ export function getControlLocaleMessageFact(key) {
65
125
  var fact = catalog.localeMessages[key];
66
126
  return fact ? clone(fact) : undefined;
@@ -1,4 +1,4 @@
1
- import { ControlCatalogInfo, ControlDefinition, ControlLocaleMessageFact, ControlSettingFact } from './types';
1
+ import { ControlCatalogInfo, ControlDefinition, ControlLocaleMessageFact, ControlSavedPropertyFact, ControlSettingFact } from './types';
2
2
  /** 返回独立副本,避免调用方污染进程内共享 catalog。 */
3
3
  export declare function getControlDefinition(type: string): ControlDefinition | undefined;
4
4
  /** 控件列表按 type 稳定排序,生成器与运行时查询顺序保持一致。 */
@@ -8,6 +8,13 @@ export declare function hasControlDefinition(type: string): boolean;
8
8
  export declare function listControlTypes(): string[];
9
9
  export declare function getControlEventKeys(type: string): string[];
10
10
  export declare function getControlSettingFacts(type: string): ControlSettingFact[];
11
+ /**
12
+ * 按保存键查询目标控件的实际属性支持事实。
13
+ *
14
+ * propsSchema 可能声明了工厂默认模型未实际物化的可选属性,因此必须同时命中
15
+ * propertyNameMap 与 defaultProps,才能作为控件切换时的能力证据。
16
+ */
17
+ export declare function getControlSavedPropertyFact(type: string, savedPropertyKey: string): ControlSavedPropertyFact | undefined;
11
18
  /** headless 按稳定 key 窄查消息事实,避免复制整份 catalog。 */
12
19
  export declare function getControlLocaleMessageFact(key: string): ControlLocaleMessageFact | undefined;
13
20
  export declare function getControlCatalogInfo(): ControlCatalogInfo;
@@ -9,6 +9,18 @@ export interface ControlSettingFact {
9
9
  min?: number;
10
10
  max?: number;
11
11
  }
12
+ /**
13
+ * generated catalog 对单个保存属性的窄事实投影。
14
+ *
15
+ * 只有 propertyNameMap 已声明保存键、且真实 Designer 默认模型已物化该属性时
16
+ * 才会产生此事实。它只证明目标控件支持该保存属性,不自动授权跨控件继承或任意写入。
17
+ */
18
+ export interface ControlSavedPropertyFact {
19
+ controlType: string;
20
+ defaultValue: JsonValue;
21
+ propertyKey: string;
22
+ savedPropertyKey: string;
23
+ }
12
24
  /** 由 i18n_messages 发布生成的紧凑文案事实,不包含运行时 i18n 实例。 */
13
25
  export interface ControlLocaleMessageFact {
14
26
  key: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteluck-fe/model-driven-controls",
3
- "version": "7.1.0-beta.0",
3
+ "version": "7.1.0-beta.2",
4
4
  "description": "> TODO: description",
5
5
  "author": "郝晨光 <2293885211@qq.com>",
6
6
  "homepage": "",
@@ -49,10 +49,10 @@
49
49
  "postpublish": "node ../../scripts/postpublish.js"
50
50
  },
51
51
  "dependencies": {
52
- "@byteluck-fe/model-driven-core": "7.1.0-beta.0",
53
- "@byteluck-fe/model-driven-settings": "7.1.0-beta.0",
54
- "@byteluck-fe/model-driven-shared": "7.1.0-beta.0",
52
+ "@byteluck-fe/model-driven-core": "7.1.0-beta.2",
53
+ "@byteluck-fe/model-driven-settings": "7.1.0-beta.2",
54
+ "@byteluck-fe/model-driven-shared": "7.1.0-beta.2",
55
55
  "async-validator": "3.5.1"
56
56
  },
57
- "gitHead": "78682a215e8062a5d24ee9773d2b274c6284ba07"
57
+ "gitHead": "68b8a947f7a0bc1b0e4ec68a71aafac5e0e7cd37"
58
58
  }