@king-design/react 3.3.2 → 3.4.0-beta.0

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.
@@ -90,7 +90,7 @@ setDefault(function () {
90
90
  makeGroupMenuStyles == null || makeGroupMenuStyles.clearCache();
91
91
  });
92
92
  export var makeStyles = cache(function makeStyles(k) {
93
- return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&.", k, "-fixed-right:before{left:-2px;}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-table-arrow{width:", table.arrow.width, "!important;margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
93
+ return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&.", k, "-fixed-right:before{left:-2px;}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-hidden{display:none;}.", k, "-table-arrow{width:", table.arrow.width, "!important;margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
94
94
  return /*#__PURE__*/css(".", k, "-align-", type, "{text-align:", type, ";}");
95
95
  }), ">.", k, "-pagination{margin:16px 0;}&.", k, "-fix-header{min-height:0;.", k, "-table-wrapper{height:100%;}}");
96
96
  });
@@ -84,7 +84,7 @@ export default function ($props, $blocks, $__proto__) {
84
84
  var onStart = this.resizable.start;
85
85
  var colgroup = _$ce(2, 'colgroup', [checkType !== 'none' ? _$ce(2, 'col', null, 1, null, _$tmp0) : undefined, _$ma(cols, function ($value, $key) {
86
86
  var _$cn2;
87
- return _$ce(2, 'col', null, 1, _$cn((_$cn2 = {}, _$cn2[$value.className] = $value.className, _$cn2)), {
87
+ return _$ce(2, 'col', null, 1, _$cn((_$cn2 = {}, _$cn2[k + "-hidden"] = $value.hidden, _$cn2[$value.className] = $value.className, _$cn2)), {
88
88
  'width': $value.width,
89
89
  'style': {
90
90
  width: getWidth($value.key)
@@ -4,6 +4,7 @@ import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/spl
4
4
  import { useInstance } from 'intact-react';
5
5
  import { watchState } from '../../hooks/useState';
6
6
  import { toggleArray } from '../utils';
7
+ import { useReceive } from '../../hooks/useReceive';
7
8
  export var AllCheckedStatus;
8
9
  (function (AllCheckedStatus) {
9
10
  AllCheckedStatus[AllCheckedStatus["All"] = 0] = "All";
@@ -176,7 +177,8 @@ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, lo
176
177
  function triggerEvent(isChecked, key, rowIndex) {
177
178
  instance.trigger(isChecked ? 'checkRow' : 'uncheckRow', data.value[rowIndex], rowIndex, key);
178
179
  }
179
- instance.on('$receive:children', updateAllCheckedStatus);
180
+ // instance.on('$receive:children', updateAllCheckedStatus);
181
+ useReceive(['children'], updateAllCheckedStatus);
180
182
  instance.on('$change:checkedKeys', updateAllCheckedStatus);
181
183
  // for draggable
182
184
  watchState(data, updateAllCheckedStatus);
@@ -61,7 +61,7 @@ export function useColumns() {
61
61
  props.children = null;
62
62
  props.cols = 1;
63
63
  cols.push(props);
64
- maxCols++;
64
+ if (!props.hidden) maxCols++;
65
65
  Object.defineProperty(props, 'rows', {
66
66
  get: function get() {
67
67
  return maxRows - row;
@@ -1,5 +1,6 @@
1
1
  import { useInstance } from 'intact-react';
2
2
  import { watchState } from '../../hooks/useState';
3
+ import { useReceive } from '../../hooks/useReceive';
3
4
  export function useDisableRow(loopData, data) {
4
5
  var instance = useInstance();
5
6
  var enabledKeys = [];
@@ -36,7 +37,8 @@ export function useDisableRow(loopData, data) {
36
37
  function getAllKeys() {
37
38
  return allKeys;
38
39
  }
39
- instance.on('$receive:children', setDisabledKeys);
40
+ // instance.on('$receive:children', setDisabledKeys);
41
+ useReceive(['children'], setDisabledKeys);
40
42
  watchState(data, setDisabledKeys);
41
43
  return {
42
44
  isDisabled: isDisabled,
@@ -1,5 +1,6 @@
1
1
  import { useInstance } from 'intact-react';
2
2
  import { watchState } from '../../hooks/useState';
3
+ import { useReceive } from '../../hooks/useReceive';
3
4
  export function useMerge(getCols, data) {
4
5
  var instance = useInstance();
5
6
  var grid = [];
@@ -58,7 +59,11 @@ export function useMerge(getCols, data) {
58
59
  function getGrid() {
59
60
  return grid;
60
61
  }
61
- instance.on('$receive:children', handleSpans);
62
+ /**
63
+ * https://github.com/ksc-fe/kpc/issues/1008
64
+ */
65
+ // instance.on('$receive:children', handleSpans);
66
+ useReceive(['children'], handleSpans);
62
67
  watchState(data, handleSpans);
63
68
  return {
64
69
  getGrid: getGrid
@@ -263,7 +263,24 @@ export function strPad(str, length, pad) {
263
263
  }
264
264
  return str;
265
265
  }
266
+ /**
267
+ * 在vue3.0中,数组会转成Proxy对象,需要获取原始数据比较
268
+ * https://github.com/ksc-fe/kpc/issues/985
269
+ * https://github.com/vuejs/core/blob/main/packages/reactivity/src/reactive.ts
270
+ */
271
+ var RAW = '__v_raw';
272
+ function isProxy(value) {
273
+ return value ? !!value[RAW] : false;
274
+ }
275
+ function toRaw(observed) {
276
+ var raw = observed && observed[RAW];
277
+ return raw ? toRaw(raw) : observed;
278
+ }
266
279
  export function isEqualArray(a, b) {
280
+ if (a === b) return true;
281
+ // for vue3.0 Proxy object
282
+ if (isProxy(a)) a = toRaw(a);
283
+ if (isProxy(b)) b = toRaw(b);
267
284
  if (a === b) return true;
268
285
  if (Array.isArray(a) && Array.isArray(b)) {
269
286
  if (a.length !== b.length) return false;
package/i18n/en-US.js CHANGED
@@ -1,3 +1,4 @@
1
+ import _globalThis from "@babel/runtime-corejs3/core-js/global-this";
1
2
  var i18n = {
2
3
  // datepicker
3
4
  'yearMonthFormat': 'MM YYYY',
@@ -107,6 +108,9 @@ var i18n = {
107
108
  '复制': 'Copy'
108
109
  };
109
110
  export default i18n;
110
- if (typeof global.Kpc !== 'undefined') {
111
- global.Kpc.localize(i18n);
111
+ /**
112
+ * global does not exist in Vite, use standard object globalThis
113
+ */
114
+ if (typeof _globalThis.Kpc !== 'undefined') {
115
+ _globalThis.Kpc.localize(i18n);
112
116
  }
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.3.2
2
+ * @king-design v3.4.0-beta.0
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -63,7 +63,7 @@ export * from './components/treeSelect';
63
63
  export * from './components/upload';
64
64
  export * from './components/view';
65
65
  export * from './components/wave';
66
- export declare const version = "3.3.2";
66
+ export declare const version = "3.4.0-beta.0";
67
67
 
68
68
 
69
69
  export {normalize} from 'intact-react';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.3.2
2
+ * @king-design v3.4.0-beta.0
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -64,7 +64,7 @@ export * from './components/treeSelect';
64
64
  export * from './components/upload';
65
65
  export * from './components/view';
66
66
  export * from './components/wave';
67
- export var version = '3.3.2';
67
+ export var version = '3.4.0-beta.0';
68
68
  /* generate end */
69
69
 
70
70
  export {normalize} from 'intact-react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@king-design/react",
3
- "version": "3.3.2",
3
+ "version": "3.4.0-beta.0",
4
4
  "description": "King-Design UI components for React.",
5
5
  "keywords": [
6
6
  "component",
@@ -36,7 +36,7 @@
36
36
  "@emotion/css": "^11.5.0",
37
37
  "dayjs": "^1.10.7",
38
38
  "enquire.js": "^2.1.6",
39
- "intact-react": "3.0.34",
39
+ "intact-react": "3.0.37",
40
40
  "monaco-editor": "^0.26.1",
41
41
  "mxgraphx": "^4.0.7",
42
42
  "resize-observer-polyfill": "^1.5.1",